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

xml standalone property #220

Closed
py-b opened this issue May 6, 2018 · 3 comments
Closed

xml standalone property #220

py-b opened this issue May 6, 2018 · 3 comments

Comments

@py-b
Copy link

py-b commented May 6, 2018

Hello,
I can't find the way to add a standalone="yes" property in the xml_document.
Did I miss something in the package documentation?

@py-b
Copy link
Author

py-b commented Apr 12, 2019

Still interested by the answer, one year later...

@jimhester
Copy link
Member

It might help if you give a little more context with a simple example document you are trying to create.

This sort of question could also be a better fit for https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)

@pmlefeuvre-met
Copy link

pmlefeuvre-met commented Mar 5, 2024

I am also wondering if one could add standalone=yes to the xml header, currently xml2 has only the option to add version and encoding:

> doc <- xml_new_document()
> as(doc, "character")
[1] "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

When I am required to have:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

I am not sure how one could update xml_new_document to keep its current output while making the standalone an option due to underlying C code in doc_new

xml_new_document <- function(version = "1.0", encoding = "UTF-8") {
  doc <- .Call(doc_new, version, encoding)
  out <- list(doc = doc)
  class(out) <- "xml_document"
  out
}

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

3 participants