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

No way to set the value of an attribute to the empty string #198

Closed
chrislad opened this issue Nov 7, 2017 · 1 comment
Closed

No way to set the value of an attribute to the empty string #198

chrislad opened this issue Nov 7, 2017 · 1 comment

Comments

@chrislad
Copy link

chrislad commented Nov 7, 2017

It doesn't seem to be possible to set the value of an attribute to the empty string. This is valid XML and there's no problem parsing such an attribute:

library(xml2) # v.1.1.1

# reading
x <- read_xml("<a foo='' />")
n <- xml_find_first(x, "/a")
xml_attrs(n) # named character vector of length 1

# writing
xml_set_attr(n, "foo", "bar")
xml_attrs(n) # named character vector of length 1

xml_set_attr(n, "foo", "")
xml_attrs(n) # named character vector of length 0

Is there another way to set the value of the attribute to the empty string?

@jimhester
Copy link
Member

Sorry, this was a deficiency in the implementation, should now be fixed.

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

2 participants