Module rxml::parser

source · []
Expand description

Restricted XML 1.0 parsing facilities

This module contains parsing facilities for processing a token stream generated by the Lexer. To satisfy different styles of tree building, the parsing step is again separated in two stages: the logical stage and the namespace/attribute resolution stage.

Logical stage

In the logical stage, the logical elements of the XML document are emitted as RawEvent structs. These may be used by end-users to build XML document models, but they are not completely validated even to the XML 1.0 specification. The caveats are documented at the Parser struct.

Namespace/attribute resolution stage

This stage resolves namespace declarations found in a stream of RawEvent structs and emits ResolvedEvent structs. It is implemented by the NamespaceResolver struct.

Together with the validation of the logical stage, this provides full conformity checks according to XML 1.0 and Namespaces for XML 1.0.

The downside of using this stage is added processing cost, because considerable dynamic allocations need to be performed per-element (for attribute hash maps). In addition, information about the prefixes used to declare namespaces is lost (but nothing should rely on those anyway).

Structs

Carry measurement information about the event

Wrapper around Lexer and std::io::BufRead to provide a TokenRead.

Namespace/Attribute resolver

Low-level restricted XML 1.0 parser

Low-level, logical restricted XML 1.0 parser

Enums

Logical XML document parts

High-level, logical XML document parts

XML version number

Constants

XML core namespace URI (for the xml: prefix)

XML namespace URI (for the xmlns: prefix)

Statics

Traits

Trait for parser-like structs.

Read individual tokens from a source

Trait for things which can be constructed with a context::Context.

Type Definitions

Shared namespace URI

Pair of an optional namespace prefix and a localpart, commonly used in element and attribute names.

Wrapper pointer around namespace URIs

Pair of an optional namespace name (URI) and a localpart, commonly used in element and attribute names.