Skip to main content

Module chvalid

Module chvalid 

Source
Expand description

XML character-class validation (upstream chvalid.c / parserInternals.c).

The exported xmlIs* family and xmlCharInRange use the generated character-class tables from unicode_tables.rs (extracted verbatim from upstream codegen/ranges.inc; see tools/archaeology/gen_chvalid_tables.py).

§UPSTREAM-PARITY

The semantics mirror upstream chvalid.h macros exactly:

  • xmlIsBaseCharQ: (c < 0x100) ? xmlIsBaseChar_ch(c) : xmlCharInRange(c, &xmlIsBaseCharGroup)
  • xmlIsBlankQ: (c < 0x100) ? (c==0x20 || 0x9<=c<=0xa || c==0xd) : 0
  • xmlIsCharQ: (c < 0x100) ? (0x9<=c<=0xa || c==0xd || 0x20<=c) : (0x100<=c<=0xd7ff || 0xe000<=c<=0xfffd || 0x10000<=c<=0x10ffff)
  • xmlIsCombiningQ: (c < 0x100) ? 0 : xmlCharInRange(c, &xmlIsCombiningGroup)
  • xmlIsDigitQ: (c < 0x100) ? (0x30<=c<=0x39) : xmlCharInRange(c, &xmlIsDigitGroup)
  • xmlIsExtenderQ: (c < 0x100) ? (c==0xb7) : xmlCharInRange(c, &xmlIsExtenderGroup)
  • xmlIsIdeographicQ: (c < 0x100) ? 0 : (0x4e00<=c<=0x9fa5 || c==0x3007 || 0x3021<=c<=0x3029)
  • xmlIsPubidCharQ: (c < 0x100) ? xmlIsPubidChar_tab[c] : 0
  • xmlIsLetter: xmlIsBaseCharQ(c) || xmlIsIdeographicQ(c) (parserInternals.c)
  • xmlIsBlankNode: tree.c — text/CDATA node whose content is empty or all blank.

§Courts

CHVALID-* differential tests compare against the oracle DSO for the whole BMP + representative supplementary-plane code points.

Functions§

xmlCharInRange
Binary search over the short/long range tables (upstream xmlCharInRange, chvalid.c — the tables are sorted, so the search is exact).
xmlIsBaseChar
xmlIsBaseChar(unsigned int ch) — XML 1.0 BaseChar production.
xmlIsBlank
xmlIsBlank(unsigned int ch) — space, tab, LF, CR.
xmlIsBlankNode
xmlIsBlankNode(const xmlNode *node) — text/CDATA node with empty or whitespace-only content (tree.c 2.15).
xmlIsChar
xmlIsChar(unsigned int ch) — XML 1.0 Char production.
xmlIsCombining
xmlIsCombining(unsigned int ch) — XML 1.0 CombiningChar production.
xmlIsDigit
xmlIsDigit(unsigned int ch) — XML 1.0 Digit production.
xmlIsExtender
xmlIsExtender(unsigned int ch) — XML 1.0 Extender production.
xmlIsIdeographic
xmlIsIdeographic(unsigned int ch) — XML 1.0 Ideographic production.
xmlIsLetter
xmlIsLetter(int c) — BaseChar or Ideographic (parserInternals.c).
xmlIsPubidChar
xmlIsPubidChar(unsigned int ch) — PubidChar production (ASCII table).