Skip to main content

Module parse

Module parse 

Source
Expand description

Main XSD parser event loop

This module provides the main parser that processes XSD documents using a frame-based state machine. Each XSD element type is handled by a corresponding frame that validates structure and collects content.

§Architecture

The parser uses:

  • TrackedReader for XML parsing with byte position tracking
  • NamespaceContext for scoped namespace management
  • Frame stack for nested element handling
  • create_frame factory for frame instantiation

§Example

use xsd_schema::parser::parse::parse_schema;
use xsd_schema::SchemaSet;

let mut schema_set = SchemaSet::new();
let xsd = r#"<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="root" type="xs:string"/>
</xs:schema>"#;

let doc_id = parse_schema(xsd.as_bytes(), "test.xsd", &mut schema_set)
    .expect("parse failed");
assert_eq!(doc_id, 0);

Structs§

ParserConfig
Parser configuration options

Functions§

parse_schema
Parse an XSD schema document
parse_schema_with_chameleon
Parse an XSD schema document with chameleon namespace support.
parse_schema_with_config
Parse an XSD schema document with custom configuration.