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

ability to add CDATA to nodes #128

Closed
jread-usgs opened this Issue Sep 20, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@jread-usgs
Copy link

commented Sep 20, 2016

xml_new_document() %>% xml_add_child('style', type='text/css', '![CDATA[<d></d>]]')

will leave out the CDATA.

This functionality would be useful for css and other things that we may be sticking in xml.

@jimhester

This comment has been minimized.

Copy link
Member

commented Dec 8, 2016

Now possible

library(xml2)
library(magrittr)
d <- xml_new_document() %>%
  xml_add_child('style', type='text/css') %>%
  xml_add_child(xml_cdata('<d></d>')) %>%
  xml_root()
as.character(d)
#> [1] "<?xml version=\"1.0\"?>\n<style type=\"text/css\"><![CDATA[<d></d>]]></style>\n"

@jimhester jimhester closed this Dec 8, 2016

@jread-usgs

This comment has been minimized.

Copy link
Author

commented Dec 8, 2016

terrific!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.