XMLElement.Rd
XML element builder
doc <- XMLDocument$new() doc <- xml_doc() elem <- XMLElement$new("meta", type = "info") elem <- xml_elem("meta", type = "info") elem$update(margin = "auto") new_elem <- elem$copy()
$new(name, ...)
Create a new XMLElement
with the given name. Extra named arguments
are treated as tag attributes, and unnamed arguments are considered child
nodes.
name | name of xml tag to create |
... | attribute name/value pairs, and child nodes |
$update(...)
Updates the attributes and children.Named arguments are considered attributes and will overwrite
existing attributes with the same name. Set to NULL to delete the attribute.
Set to NA to make this a bare attribute without a value.Unnamed arguments are appended to the list of child nodes. These
should be text, other XMLElements or any ojbect that can be represented
as a single text string using "as.character()". To be specific about
where in the child list a node will be placed, use $append()
... | attribute name/value pairs, and child nodes |
$append(...)
Append XMLElement
objects as children to this element
... | all arguments treated as XMLElement objects and added as the children of this element |
$add(name, ...)
Create a new XMLElement
and add it as a child to this element. Return the
new element. See $new()
for description of arguments.
$remove(indices)
Remove XMLElement
child objects from this element by index.
indices | indices of XMLElement objects to remove |
$as_character()
Convert XMLElement
to a character string.
$print()
Print XMLElement
to terminal.
$copy()
Copy XMLElement
.
if (FALSE) { XMLElement$new('div', class = ".big", "DIV contents") }