Expand description
Character classification for XML 1.0 names.
§ASCII lookup tables
Two 256-entry tables let callers classify ASCII bytes with a single array access. Bytes ≥ 0x80 are always zero in the table; callers must fall back to the Unicode range functions for those.
ASCII_XML_NAME— XMLName(§2.3)::counts as a name-start char.ASCII_NCNAME— XPathNCName::is a separator, not part of a name.
§Unicode range functions
Non-ASCII characters are checked with is_name_start_char / is_name_char_unicode
(5th edition, the current default) or is_name_start_char_4e / is_name_char_4e
(4th edition, enabled via ParseOptions::xml10_fourth_edition).
Both editions agree on all ASCII characters; the tables above handle those uniformly. The non-ASCII functions cover ≥ 0x80 only.
Constants§
- ASCII_
NCNAME - XPath
NCNamelookup table. Excludes:(it is a separator in XPath). Bytes ≥ 0x80 are0; useis_name_start_char/is_name_char_unicodefor those. - ASCII_
XML_ NAME - XML
Namelookup table. Includes:as a name-start char (§2.3). Bytes ≥ 0x80 are0; useis_name_start_char/is_name_char_unicode(or their 4th-edition counterparts) for those. - ASCII_
XML_ NAME_ CHAR - Boolean fast-path: 1 iff the byte is an ASCII
NameChar(NS|NC) per XML 1.0 § 2.3 production [4a]. Non-ASCII bytes (≥ 0x80) are0so the tight inner loop inscan_name_rawexits and falls into the explicit UTF-8 path. Layout matchesASCII_XML_NAMEforNS|NC. - NC
- Byte is an ASCII name character but NOT a name-start (
0–9,-,.). - NS
- Byte is an ASCII name-start character (A–Z, a–z,
_, and for XML Name,:).
Functions§
- is_
name_ char_ 4e - XML 1.0 §2.3 NameChar — 4th edition.
- is_
name_ char_ unicode - Returns
trueifc(≥ U+0080) is a valid XML 1.0 5th-edition name character. ASCII name chars (0–9,-,.) are handled by the tables. - is_
name_ start_ char - Returns
trueifc(≥ U+0080) is a valid XML 1.0 5th-edition name-start character. The:and_cases are ASCII and handled by the tables. - is_
name_ start_ char_ 4e - XML 1.0 §2.3 NameStartChar — 4th edition (
Letter | '_' | ':').