Skip to main content

Module scan

Module scan 

Source
Expand description

RelaxNG XML → AST scanner.

Port of RelaxNG.pm lines 100–390. The Perl original is a recursive visitor over a LibXML::Document; this is a recursive visitor over libxml::tree::Node.

The scanner is side-effect-free with respect to the AST: it returns a Vec<Pattern> per node and never mutates Relaxng’s definition tables. The only pieces it touches on Relaxng are internal_grammars (a fresh counter for embedded <grammar> blocks) and document_namespaces (driven by xmlns: declarations on RelaxNG nodes — analogous to Model::registerDocumentNamespace in Perl). Definition recording, “Used by” graph, element tables — all happen during super::simplify.

The matching style intentionally mirrors getRelaxOp + the $relaxop eq 'rng:foo' cascade in Perl, so a reader who knows the original code finds the same shape here.

Enums§

ScanError
Errors a scan can produce.

Functions§

scan_external
Locate, parse, and scan a single RelaxNG schema file.
scan_string
Scan an already-parsed RelaxNG XML root in-memory. Useful for unit tests that pass small RNG fragments inline.