parse

Function parse 

Source
pub fn parse(xml: &str) -> Result<DampenDocument, ParseError>
Expand description

Parse XML markup into a DampenDocument.

This is the main entry point for the parser. It takes XML markup and converts it into the Intermediate Representation (IR) suitable for rendering or code generation.

§Arguments

  • xml - XML markup string

§Returns

Ok(DampenDocument) on success, Err(ParseError) on failure

§Examples

use dampen_core::parse;

let xml = r#"<dampen><column><text value="Hello" /></column></dampen>"#;
let doc = parse(xml).unwrap();
assert_eq!(doc.root.children.len(), 1);

§Errors

Returns ParseError for:

  • Invalid XML syntax
  • Unknown widget elements
  • Invalid attribute values
  • Malformed binding expressions