Function parse_articles_from_xml
pub fn parse_articles_from_xml(
xml: &str,
) -> Result<Vec<PubMedArticle>, ParseError>Expand description
Parse multiple PubMed articles from EFetch XML response
This function parses an XML response containing multiple <PubmedArticle> elements,
typically returned when fetching from the NCBI history server.
§Arguments
xml- The raw XML string from PubMed EFetch API containing multiple articles
§Returns
A Result<Vec<PubMedArticle>> containing all successfully parsed articles.
Articles that fail to parse are logged and skipped.
§Example
ⓘ
use pubmed_client::pubmed::parser::parse_articles_from_xml;
let xml = r#"<?xml version="1.0"?>
<PubmedArticleSet>
<PubmedArticle>...</PubmedArticle>
<PubmedArticle>...</PubmedArticle>
</PubmedArticleSet>"#;
let articles = parse_articles_from_xml(xml)?;
println!("Parsed {} articles", articles.len());