Skip to main content

from_xml_reader_async

Function from_xml_reader_async 

Source
pub async fn from_xml_reader_async<R: AsyncRead + Unpin>(
    reader: R,
    config: &FromXmlConfig,
) -> Result<Document, String>
Expand description

Parse XML from an async reader

This function reads the entire content into memory before parsing. For streaming large files, use from_xml_stream_async instead.

§Examples

use hedl_xml::async_api::from_xml_reader_async;
use hedl_xml::FromXmlConfig;
use tokio::fs::File;

let file = File::open("data.xml").await?;
let config = FromXmlConfig::default();
let doc = from_xml_reader_async(file, &config).await?;

§Errors

Returns an error if reading fails or if XML parsing fails.