Skip to content

suppressing xmlXPathEval: evaluation failed #209

Closed
@dhicks

Description

@dhicks

I'm working on a script to extract data from 33k xml files, so I'd like to suppress all warnings and messages. But the warning-like xmlXPathEval: evaluation failed that shows up on certain kinds of errors (an undefined namespace, in the MWE) doesn't seem to be either a message or a warning. What is this, and how can I suppress it?

MWE:

library(xml2)

file = '2-s2.0-0015762931.xml'
xml = read_xml(file)

out = xml_find_first(xml, '//dc:identifier')
suppressWarnings(out <- xml_find_first(xml, '//dc:identifier'))
suppressMessages(out <- xml_find_first(xml, '//dc:identifier'))

if (require(purrr)) {
    out = quietly(xml_find_first)(xml, '//dc:identifier')
}

2-s2.0-0015762931.xml.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions