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
Closed

ability to add CDATA to nodes #128

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

Comments

@jread-usgs
Copy link

@jread-usgs jread-usgs 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
Copy link
Member

@jimhester jimhester 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
Copy link
Author

@jread-usgs jread-usgs commented Dec 8, 2016

terrific!

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

Successfully merging a pull request may close this issue.

None yet
2 participants