Expand description
A pull tokenizer for the XML subset Office Open XML parts use.
Parts are UTF-8 (a byte order mark is skipped), namespace-aware, and
carry no DTD. The tokenizer borrows every name and text run from the
input, resolves namespace prefixes against a small table of the
namespaces the reader knows (Transitional and Strict URIs map to the
same Ns), skips comments and processing instructions, and hands
back CDATA as text. Character references, the five predefined
entities and the _xHHHH_ escape convention are decoded by
unescape_into, only when a text run contains them.
Well-formedness is checked as far as the tokenizer must to make
progress: mismatched or unterminated tags are errors. Everything else
is lenient by default so a damaged slide still yields its text; the
verifier runs well_formed for the full check.
Structs§
- Attr
- One attribute with its raw (still escaped) value.
- Attrs
- Iterator over the attributes of a start tag, resolved against the reader’s namespaces in scope.
- Name
- A resolved element or attribute name.
- Reader
- The pull tokenizer.
- Start
- A start tag.
- XmlError
- A tokenizer error with the byte offset it was found at.
Enums§
- Conformance
- Which family of namespace URIs a document uses.
- Event
- One token of the document.
- Ns
- A namespace the reader recognizes.
Functions§
- invalid_
char_ offset - Offset of the first byte that XML 1.0 forbids in character data (controls other than tab, newline and carriage return), if any.
- is_
ncname - Whether
nameis an XML NCName (ASCII rules; non-ASCII bytes are accepted). - transitional_
uri - The URI of a namespace known to the reader, Transitional form.
- unescape_
attr - Decodes only XML entities and character references, leaving
_xHHHH_sequences untouched (for attribute values such as part names). - unescape_
into - Decodes character references, the five predefined entities and
_xHHHH_escapes fromraw, appending toout. Unknown entities and malformed references are kept literally; invalid UTF-8 is replaced. - well_
formed - Runs the strict tokenizer over a whole part, returning the first error.