Skip to main content

from_xml

Function from_xml 

Source
pub fn from_xml(file: &str, output: Option<&str>) -> Result<(), CliError>
Expand description

Convert an XML file to HEDL format.

Parses an XML file and converts it to canonical HEDL format.

§Arguments

  • file - Path to the XML file to convert
  • output - Optional output file path. If None, writes to stdout

§Returns

Returns Ok(()) on success.

§Errors

Returns Err if:

  • The file cannot be read
  • The XML is malformed
  • XML-to-HEDL conversion fails
  • HEDL canonicalization fails
  • Output writing fails

§Examples

use hedl_cli::commands::from_xml;

// Convert XML to HEDL on stdout
from_xml("data.xml", None)?;

// Convert XML to HEDL file
from_xml("data.xml", Some("output.hedl"))?;