Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppressing xmlXPathEval: evaluation failed #209

Closed
dhicks opened this issue Feb 4, 2018 · 2 comments
Closed

suppressing xmlXPathEval: evaluation failed #209

dhicks opened this issue Feb 4, 2018 · 2 comments

Comments

@dhicks
Copy link

dhicks commented Feb 4, 2018

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

@jimhester
Copy link
Member

The message is coming from the libxml2 library directly, which is why you are unfortunately not able to suppress it yourself. It may be possible to work around this in the future, so please leave this issue open.

@RobertMyles
Copy link

RobertMyles commented Jun 13, 2018

I'd also like to know if it's possible to suppress these messages/errors, some users of a package of mine seem to be confused as to whether the package is working correctly when they see these messages. (Issue here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants