Element and Attribute Naming

The property set Type (which maps to an XML element name) and the names of individual properties (which map to XML attribute names) do not necessarily follow the XML naming rules. For example, a name can include characters such as a space, a quote, a colon, a left parenthesis, or a right parenthesis that are not allowed in XML element or XML attribute names. As a result, you must perform some conversion to generate a valid XML document.

When creating an XML document from a property set hierarchy, the XML Converter will make sure that legal XML names are generated. There are two different approaches provided to handle name translation. The approach is determined by the EscapeNames user property on the XML Converter service. This user property can be either True or False.

  • True. If EscapeNames is True, instances of illegal characters are converted to an escape sequence that uses only legal characters. For example, a space is converted to the characters _spc. When an XML document is parsed to a property set hierarchy, the escape sequences are converted back to the original characters. For example, the name Account (SSE) becomes Account_spc_lprSSE_rpr.

    The following table shows the escape sequences that are used by the XML Converter.

    Character in Property Set Description Generated Escape Sequence

    Space

    _spc

    _

    Underscore

    _und

    Double Quote

    _dqt

    Single Quote

    _sqt

    :

    Colon

    _cln

    ;

    Semicolon

    _scn

    (

    Left Parenthesis

    _lpr

    )

    Right Parenthesis

    _rpr

    &

    Ampersand

    _amp

    ,

    Comma

    _cma

    #

    Pound symbol

    _pnd

    /

    (Forward) slash

    _slh

    ?

    Question Mark

    _qst

    <

    Less Than

    _lst

    >

    Greater Than

    _grt

    Illegal characters

    Other illegal characters not listed in this table

    _<Unicode character code>

  • False. If EscapeNames is False, the XML Converter removes illegal characters. These characters include the space ( ), double quote ("), single quote('), semicolon (;), left parenthesis ((), right parenthesis ()), and ampersand (&). For example, the XML Converter changes the name Account (SSE) to AccountSSE.

    Note: These conversions are not reversible: the original names cannot be obtained from the XML names.

If a property set instance does not have a value for its Type member variable, the XML Converter uses the name PropertySet for the corresponding element’s name.