Skip to content

write_xml does not work with R 4.0.0 #307

@munozav

Description

@munozav

Dear all,
Thanks for your great package, it has helped me a lot!.
I don't know if this is the place to ask you, but after upgrading to version R 4.0.0, the write_xml function no longer works. Returns NULL without writing any xml files.

Thank you very much for any information you can provide to this macOS user.

x <- read_xml("<body>
  <p>Some <b>text</b>.</p>
  <p>Some <b>other</b> <b>text</b>.</p>
  <p>No bold here!</p>
</body>")

# Get only words in bold
boldWords <- xml_find_all(x, ".//b")

# Add each node in nodeset to a new document
boldDocument = xml_new_root('newBody')
for (child in boldWords) {
  xml_add_child(boldDocument, child, 'newBody')
}

# Save subset xml in a new file
tmp = tempfile(fileext = ".xml")
write_xml(boldDocument, file = tmp, options = 'as_xml')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions