Skip to main content

Module endnote_xml

Module endnote_xml 

Source
Expand description

EndNote XML format parser implementation.

Provides functionality to parse EndNote XML formatted citations with improved structure and error handling. EndNote XML is an export format from EndNote reference management software.

§Example

use biblib::{CitationParser, EndNoteXmlParser};

let xml_content = r#"
<?xml version="1.0" encoding="UTF-8"?>
<xml>
  <records>
    <record>
      <ref-type name="Journal Article">17</ref-type>
      <contributors>
        <authors>
          <author>Doe, John</author>
          <author>Smith, Jane</author>
        </authors>
      </contributors>
      <titles>
        <title>Sample Research Article</title>
        <secondary-title>Journal of Science</secondary-title>
      </titles>
      <volume>15</volume>
      <number>3</number>
      <pages>123-135</pages>
      <year>2023</year>
      <electronic-resource-num>10.1234/example.doi</electronic-resource-num>
    </record>
  </records>
</xml>
"#;

let parser = EndNoteXmlParser::new();
let citations = parser.parse(xml_content).unwrap();
assert_eq!(citations.len(), 1);

let citation = &citations[0];
assert_eq!(citation.title, "Sample Research Article");
assert_eq!(citation.journal, Some("Journal of Science".to_string()));
assert_eq!(citation.authors.len(), 2);
assert_eq!(citation.authors[0].name, "Doe");
assert_eq!(citation.authors[0].given_name.as_deref(), Some("John"));

Structs§

EndNoteXmlParser
Parser for EndNote XML format citations.