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

Comments

Projects
None yet
2 participants
@chrislad

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 jimhester closed this in 7896cfa Jan 4, 2018

@jimhester

This comment has been minimized.

Member

jimhester commented Jan 4, 2018

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