replaceNodeWithChildren: Replace an XML node with it child nodes

Description Usage Arguments Value Author(s) References Examples

View source: R/xmlNodes.R

Description

This function can be used to flatten parts of an XML tree. This takes a node and removes itself from the tree, but places its kids in it place.

Usage

1

Arguments

node

an XMLInternalNode object

Value

NULL. The purpose of this function is to modify the internal document.

Author(s)

Duncan Temple Lang

References

libxml2 documentation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
doc = xmlParse('<doc>
                 <page>
                  <p>A</p>
                  <p>B</p>
                  <p>C</p>
                 </page>
                 <page>
                  <p>D</p>
                  <p>E</p>
                  <p>F</p>
                 </page>
                </doc>')

pages = getNodeSet(doc, "//page")
invisible(lapply(pages, replaceNodeWithChildren))
doc

XML documentation built on Sept. 17, 2021, 9:06 a.m.