Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Interfaces for Writing XFN Applications Parameters Used in Extended Search (Preliminary Specification) Search Filter Substitute Tokens in Search Filter Expressions  Previous   Contents   Next 
   
 

Parsing Compound Names

Because most applications treat names as opaque data, most clients of the XFN interface do not need to parse compound names from specific naming systems. When an application (such as a browser) needs to do this, however, it can use the FN_compound_name_t object.

Syntax Attributes

Each context has an associated set of syntax-related attributes. The attribute fn_syntax_type (FN_ID_STRING format) identifies the naming syntax supported by the context. The value "standard" (ASCII attribute syntax) in the fn_syntax_type attribute specifies that the context supports the XFN standard syntax model that is by default supported by the FN_compound_name_t object.

Implementations can choose to support other syntax types in addition to or in place of the XFN standard syntax model, in which case the value of the fn_syntax_type attribute is set to an implementation-specific string and different or additional syntax attributes are in the set.

Syntax attributes of a context can be generated automatically by a context, in response to fn_ctx_get_syntax_attrs(), or can be created and updated using the attribute operations. This is implementation dependent.

XFN Standard Syntax Model

Each naming system in an XFN federation has a naming convention. XFN defines a standard model of expressing compound name syntax that covers a large number of specific name syntaxes. This model is expressed in terms of syntax properties of the naming convention and it uses XFN attributes to describe properties of the syntax.

Unless otherwise qualified, the syntax attributes described in this section have attribute identifiers that use the FN_ID_STRING format. This does not specify or restrict the use of other formats for identifiers of additional syntax attributes supported by specific implementations.

In the XFN standard syntax model, these attributes are interpreted according to the following rules:

  1. In a string without quotes or escapes, any instance of the separator string delimits two atomic names.

  2. A separator, quotation mark, or escape string is escaped if preceded immediately (on the left) by the escape string.

  3. A non-escaped begin-quote that precedes a component must be matched by a non-escaped end-quote at the end of the component. Quotes embedded in nonquoted names are treated as simple characters and do not need to be matched. An unmatched quotation fails with the status code FN_E_ILLEGAL_NAME.

  4. If there are multiple values for begin-quote and end-quote, a specific begin-quote value must be matched with its corresponding end-quote value.

  5. When the separator appears between a (nonescaped) begin-quote and the end-quote, it is ignored.

  6. When the separator is escaped, it is not treated as a separator. An escaped begin-quote or end-quote string is not treated as a quotation mark. An escaped escape string is not treated as an escape string.

  7. A non-escaped escape string appearing within quotes is interpreted as an escape string. This can be used to embed an end-quote within a quoted string.

  8. An escape string that precedes a character other than an escape string, a begin-quote or an end-quote is consumed (in other words, escaping a non-meta character returns the non-meta character itself).

After constructing a compound name from a string, the resulting component atoms have one level of escape strings and quotations interpreted and consumed.

Code set mismatches that occur during the construction of the compound name's string form are resolved in an implementation-dependent way. When an implementation discovers that a compound name has components with incompatible code sets, it returns the error code FN_E_INCOMPATIBLE_CODE_SETS. When an implementation discovers that a compound name has components with incompatible language or territory locale information, it returns the error code FN_E_INCOMPATIBLE_LOCALES.

Table 2-11 lists all the XFN standard syntax model attributes.

Table 2-11 XFN Syntax Attributes

Attribute Identifier

Attribute Value

fn_syntax_type

Its value is the ASCII string "standard" if the context supports the XFN standard syntax model. Its value is an implementation-specific value if another syntax model is supported.

fn_synt

ax_direction

Its value is an ASCII string, one of "left-to-right," "right-to-left," or "flat." This determines whether the order of components in a compound name string goes from left-to-right, right-to-left, or whether the namespace is flat (that is, not hierarchical, with all names atomic).

fn_std_syntax_separator

Its value is the separator string for this name syntax. This attribute is required unless the fn_syntax_direction is flat.

fn_std_syntax_escape

If present, its value is the escape string for this name syntax.

fn_std_syntax_case_insensitive

If present, it indicates that names differing only in case are considered identical. If this attribute is absent, it indicates that case is significant. If a value is present, it is ignored.

fn_std_syntax_begin_quote1

If present, its value is one of the begin-quote strings for this syntax. If fn_std_syntax_end_quote1 is absent but fn_std_syntax_begin_quote1 is present, the quote-string specified in fn_std_syntax_begin_quote1 is used as both the begin and end quote-strings. If fn_std_syntax_end_quote1 is present but fn_std_syntax_begin_quote1 is absent, the quote-string specified in fn_std_syntax_end_quote1 is used as both the begin and end-quote-strings.

fn_std_syntax_end_quote1

If present, its value is the end-quote string for this syntax. If fn_std_syntax_end_quote1 is absent but fn_std_syntax_begin_quote1 is present, the quote-string specified in fn_std_syntax_begin_quote1 is used as both the begin and end quote-strings. If fn_std_syntax_end_quote1 is present but fn_std_syntax_begin_quote1 is absent, the quote-string specified in fn_std_syntax_end_quote1 is used as both the begin and end-quote-strings.

fn_std_syntax_begin_quote2

If present, its value is one of the begin-quote strings for this syntax. If fn_std_syntax_end_quote2 is absent but fn_std_syntax_begin_quote2 is present, the quote-string specified in fn_std_syntax_begin_quote2 is used as both the begin and end quote-strings. If fn_std_syntax_end_quote2 is present but fn_std_syntax_begin_quote2 is absent, the quote-string specified in fn_std_syntax_end_quote2 is used as both the begin and end-quote-strings.

fn_std_syntax_end_quote2

If present, its value is the end-quote string for this syntax. If fn_std_syntax_end_quote2 is absent but fn_std_syntax_begin_quote2 is present, the quote-string specified in fn_std_syntax_begin_quote2 is used as both the begin and end quote-strings. If fn_std_syntax_end_quote2 is present but fn_std_syntax_begin_quote2 is absent, the quote-string specified in fn_std_syntax_end_quote2 is used as both the begin and end-quote-strings.

fn_std_syntax_ava_separator

If present, its value is the attribute-value assertion separator string for this syntax.

fn_std_syntax_typeval_separator

If present, its value is the attribute type-value separator string for this syntax.

fn_std_syntax_locales

If present, its value identifies the code sets of the string representation for this syntax. Its value consists of a structure containing an array of code sets supported by the context; the first member of the array is the preferred code set of the context. The values for the code sets are defined in the X/Open code set registry currently defined in DCE RFC 40.1. If this attribute is not present, or if the value is empty, the default code set is ISO 646 (same encoding as ASCII).

Compound Names

The FN_compound_name_t type is used to represent a compound name.

The FN_compound_name_t object has associated operations for applications to process compound names that conform to the XFN standard syntax model of expressing compound name syntax. Operations are provided to iterate over the list of atomic components of the name, modify the list, and compare two compound names.

An FN_compound_name_t object is constructed using the operation fn_compound_name_from_attrset(), with arguments consisting of a string name and an attribute set that contains the attribute "fn_syntax_type" with the value "standard."

 
 
 
  Previous   Contents   Next