Federated Naming Service Programming Guide

Decomposing the Composite Name String

The function fn_composite_name_from_string() returns an XFN composite name in its structural form, FN_composite_name_t, given the composite name's string representation. The syntax rules used by fn_composite_name_from_string() are as follows:

The following are the rules for parsing a composite name.

  1. Any <ComponentSep> character that is neither escaped nor enclosed in quoted strings is considered to be a component separator.

  2. Any string enclosed by component separators is a component (<Component>).

  3. A composite name is parsed and decomposed into components from left to right:

    1. The first component is the string preceding the first occurrence of a component separator.

    2. Empty components are processed as follows:

      1. A leading component separator (the composite name begins with a component separator) means a leading null component.

      2. A trailing component separator (the composite name ends with a component separator) means a trailing null component.

    3. Two consecutive component separators mean a null component.

    4. The name string that immediately follows the last component separator of the composite name is the final component.

  4. A component string is evaluated from left to right and converted into its standard form according to the following rules:

    1. A component string is considered to be quoted if it is enclosed in a pair of matching unescaped quote characters (either a <Quote1> or a <Quote2> pair). The quoted string must represent the full component; that is, a begin quote must immediately be preceded by a component separator or no character, and the end quote must immediately be followed by a component separator or no character.

    2. If a component does not contain a valid begin quote (a <Quote1> or <Quote2> immediately preceded by either a component separator or no character), any occurrence of <Quote1> or <Quote2> within that component is treated just as any other <SimpleChar>.

    3. An unmatched begin quote (missing or misplaced end quote) fails with an FN_E_ILLEGAL_NAME status.

    4. Quotes are considered to be escaped in quoted strings if a matching quote character is preceded immediately by the unescaped <EscapeChar>.

    5. Quoted components are resolved by eliminating the quote characters from the component name and substituting possibly escaped quotes by simple quote characters. <MetaChar>s and the nonmatching quote characters enclosed in quoted strings are treated just as any other <SimpleChar>.

    6. Any of the defined metacharacters (<ComponentSep> and <EscapeChar>) is considered to be escaped in an unquoted component name string if preceded immediately by the unescaped <EscapeChar> (for instance, the sequence <EscapeChar> <EscapeChar> <ComponentSep> denotes an escaped <EscapeChar> but an unescaped <ComponentSep>).

    7. <Quote1> and <Quote2> are considered to be escaped in an unquoted component if and only if <EscapeChar> is preceded by a component separator (that is, sequences <ComponentSep> <EscapeChar> <Quote1> or <ComponentSep> <EscapeChar> <Quote2>). Other occurrences of <Quote1> and <Quote2> in an unquoted component are treated just as any other <SimpleChar>.

    8. Any occurrence of escaped <MetaChar>, escaped <Quote1>, or escaped <Quote2> in unquoted components is substituted by the corresponding unescaped character.

    9. No substitution is done for <EscapeChar> <SimpleChar>. <EscapeChar> <SimpleChar> maps to <EscapeChar> <SimpleChar>.