Skip to main content

from_xml_file_async

Function from_xml_file_async 

Source
pub async fn from_xml_file_async(
    path: impl AsRef<Path>,
    config: &FromXmlConfig,
) -> Result<Document, String>
Expand description

Read and parse an XML file asynchronously

This function reads the entire file into memory and parses it. For large files, consider using from_xml_stream_async instead.

§Examples

use hedl_xml::async_api::from_xml_file_async;
use hedl_xml::FromXmlConfig;

let config = FromXmlConfig::default();
let doc = from_xml_file_async("data.xml", &config).await?;
println!("Parsed document with {} root items", doc.root.len());

§Errors

Returns an error if the file cannot be read or if XML parsing fails.