Rules for mapping application
defined name to XML Name
[1]
XML Name has
two parts: Prefix
and LocalPart.
Let Prefix be
computed per the rules and constraints specified in Namespaces in XML.
[2]
Let TAG be a
name in an application. TAG is a sequence of characters of the application. Let
N be the number of characters in TAG. Let T1 , T2 ,..., TN
be the characters of TAG, in order from left to right.
[3]
Let M be the
implementation-defined mapping of the characters of the application to
characters of Unicode.
[4]
For each i
between 1 (one) and N, let Mi be M(Ti).
[5]
For each i
between 1 (one) and N, let Xi be the Unicode character string defined
by the following rules.
Case:
[5.1]
If Ti
has no mapping to Unicode (i.e., M(Ti) is undefined), then Xi
is implementation-defined
[5.2]
If i <= N-1,
Ti is '_' (underscore), and Ti+1 is 'x' (lowercase letter
x), then let
Xi
::= '_x005F_'
[5.3]
If N >= 3, T1
is either 'x' (lowercase letter x) or 'X' (uppercase letter X), T2
is either 'm' (lowercase letter m) or 'M' (uppercase letter M), and T3
is either 'l' (lowercase letter l) or 'L' (uppercase letter L), then
Xi
::= '_xFFFF_' T1
[5.4]
If Ti
is not a valid XML NCName
character or if i = 1 (one) and T1 is not a valid first character of
an XML NCName,
then:
Let
U1, U2 ,..., U8 be the eight hex digits
(hexDigit) such that Ti is U+ U1 U2 ... U8
in the UCS-4 encoding.
hexDigit
::= [0-9A-F]
Case:
[5.4.1]
If U1
= 0, U2 = 0, U3 = 0, and U4 = 0, then
Xi
::= '_x' U5 U6 U7 U8 '_'
This
case implies that Ti has a UCS-2 encoding, which is U+U5U6U7U8.
[5.4.2]
Otherwise, let
Xi
::= '_x' U1 U2 U3 U4 U5
U6 U7 U8 '_'
[5.5]
Otherwise, let
Xi
::= Mi
That
is, any character in TAG that is a valid character in an XML NCName is simply
copied.
[6]
Let LocalPart be the
character string concatenation of X1 , X2 ,..., and XN
in order from left to right.
LocalPart
::= X1 X2 .. XN
[7]
Let XML Name be
the QName per Namespaces in XML
QName
::= (Prefix
':')? LocalPart
XML 1.0 (Second Edition)
Extensible Markup Language (XML) 1.0, Second Edition, Tim Bray et al., eds.,
W3C, 6 October 2000. See http://www.w3.org/TR/2000/REC-xml-20001006
XML-Namespaces
Namespaces in XML, Tim Bray et al., eds., W3C, 14 January 1999. See
http://www.w3.org/TR/1999/REC-xml-names-19990114/
ISO/IEC 9075-14:200x(E)
ISO (International Organization for Standardization). Information technology -
Database languages - SQL - Part 14: XML-Related Specifications (SQL/XML),
working draft, dated 2001-06-18. See
ftp://sqlstandards.org/SC32/WG3/Progression_Documents/Informal_working_drafts/wd-xml-2001-06.pdf