-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviornamespace 📛
Description
Possibly related to 340.
The xml2 Node Modification vignette states that using NULL as the value will remove the attribute completely. In the example below, the 'space' attribute in doc1 is correctly removed using this method. However, the 'xml:space' attribute in doc2 is not getting removed using this method.
library(xml2)
doc1 = as_xml_document('<xml><t space="preserve">1</t><t space="preserve">2</t></xml>')
doc1_children = xml_children(doc1)
xml_attrs(doc1_children) <- NULL
print(doc1_children)
#> {xml_nodeset (2)}
#> [1] <t>1</t>
#> [2] <t>2</t>
doc2 = as_xml_document('<xml><t xml:space="preserve">1</t><t xml:space="preserve">2</t></xml>')
doc2_children = xml_children(doc2)
xml_attrs(doc2_children) <- NULL
print(doc2_children)
#> {xml_nodeset (2)}
#> [1] <t xml:space="preserve">1</t>
#> [2] <t xml:space="preserve">2</t>Created on 2023-04-24 with reprex v2.0.2
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviornamespace 📛