Skip to contents

Parse EndNote XML export files into an sm_corpus object. Uses xml2 to extract record metadata from the EndNote XML format.

Usage

sm_read_endnote(
  path,
  encoding = "UTF-8",
  verbose = TRUE,
  call = rlang::caller_env()
)

Arguments

path

Character scalar. Path to an EndNote XML file.

encoding

Character scalar. File encoding (default "UTF-8").

verbose

Logical. Print progress messages?

call

Caller environment for error reporting.

Value

An sm_corpus object.

Implementation

The parser uses xml2::read_xml() to read the EndNote XML format. Each xml/records/record element (or records/record) is processed. The following fields are extracted:

  • titles/title/style for the title

  • contributors/authors/author/style for author names

  • dates/year/style for year

  • periodical/full-title/style or secondary-title/style for journal

  • electronic-resource-num/style for DOI

  • abstract/style for abstract

  • ref-type attribute for document type

  • keywords/keyword/style for keywords

  • accession-num/style for record identifier

No bibliometrix engine is available since EndNote XML is not directly supported as a format by bibliometrix::convert2df().

References

Aria, M. & Cuccurullo, C. (2017). bibliometrix: An R-tool for comprehensive science mapping analysis. Journal of Informetrics, 11(4), 959–975. doi:10.1016/j.joi.2017.08.007

Examples

path <- tempfile(fileext = ".xml")
writeLines(c(
  '<?xml version="1.0" encoding="UTF-8"?>',
  "<xml><records>",
  '<record ref-type="17">',
  "  <titles><title><style>Deep Learning for Spatial Omics</style></title>",
  "  </titles>",
  "  <contributors><authors>",
  "    <author><style>Chen, Wei</style></author>",
  "  </authors></contributors>",
  "  <dates><year><style>2023</style></year></dates>",
  "  <periodical><full-title><style>Nature Methods</style></full-title>",
  "  </periodical>",
  "</record>",
  "</records></xml>"
), path)
corpus <- sm_read_endnote(path, verbose = FALSE)
corpus$works
#> # A tibble: 1 × 16
#>   work_id    doi   title abstract  year type  source_id cited_by_count oa_status
#>   <chr>      <chr> <chr> <chr>    <int> <chr> <chr>              <int> <chr>    
#> 1 W000000001 NA    Deep… NA        2023 jour… S0000000…             NA NA       
#> # ℹ 7 more variables: language <chr>, pmid <chr>, arxiv_id <chr>,
#> #   openalex_id <chr>, is_retracted <lgl>, retraction_date <date>,
#> #   last_refreshed <dttm>
unlink(path)