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

Allow docs missing a root element to be created and printed. Fixes #121. #126

Merged
merged 1 commit into from
Dec 5, 2016
Merged

Allow docs missing a root element to be created and printed. Fixes #121. #126

merged 1 commit into from
Dec 5, 2016

Conversation

sjp
Copy link
Contributor

@sjp sjp commented Sep 14, 2016

This fixes the issue described in #121.

This is mostly achieved by checking whether a document has a root element before attempting to print it.

One other minor bugfix is that an xml_document object will now print its children if they were previously absent. An example:

Before:

> library(xml2)
> doc <- xml_new_document()
> root <- xml_add_child(doc, "root")
> doc
{xml_document}

After:

> library(xml2)
> doc <- xml_new_document()
> root <- xml_add_child(doc, "root")
> doc
{xml_document}
<root>

@jimhester
Copy link
Member

This looks good, only thing needed is a short note to NEWS.md explaining the fix and thanking yourself.

@jimhester jimhester merged commit e8a6214 into r-lib:master Dec 5, 2016
@jimhester
Copy link
Member

Don't worry about the NEWS, I will add it manually.

@sjp
Copy link
Contributor Author

sjp commented Dec 5, 2016

Great, thanks!

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

Successfully merging this pull request may close these issues.

2 participants