These classes are used to create DOM trees of XML documents,
like objects that are returned
by parseXMLTree
.
is.XiMpLe.node(x)is.XiMpLe_node(x)
as_XiMpLe_node(obj, extra = list(), version = 2)
# S4 method for XiMpLe.node
as_XiMpLe_node(obj, extra = list(), version = 2)
An arbitrary R
object.
An object of old class XiMpLe.node
.
A list of values to set the extra
slot. Note that this will be applied recursively on child nodes also.
Integer numeric,
to set the version
slot. Note that this will be applied recursively on child nodes also.
name
Name of the node (i.e., the XML tag identifier). For special names see details.
attributes
A list of named character values,
representing the attributes of this node.
Use character()
as value for empty attributes.
children
A list of further objects of class XiMpLe.node, representing child nodes of this node.
value
Plain text to be used as the enclosed value of this node. Set to value=""
if you
want a childless node to be forced into an non-empty pair of start and end tags by pasteXMLNode
.
extra
A named list that can be used to store additional information on a node (XiMpLe_node
only).
The only value with a noticeable effect as of now (version 2) is:
shine
: A numeric integer value between 0 and 2,
overwriting the shine
value of, e.g., pasteXML
for this particular node.
version
A numeric integer,
currently defaults to 2 (XiMpLe_node
only). This is a version number that can be used in the future
in combination with the added extra
slot. Should that get more supported values like shine
that are interpreted by package methods,
the version number will be increased and the differences documented here. You shouldn't set it manually.
Class XiMpLe.node
is the older one,
XiMpLe_node
was introduced with XiMpLe
0.11-1. It has two new slots
(extra
and version
) that would have made it impossible to load old objects without issues. XiMpLe_node
inherits from XiMpLe.node
. You can convert old objects into valid new ones using the as_XiMpLe_node
method and
are also advised to do so,
as the XiMpLe.node
class might become deprecated in future releases.
There are certain special values predefined for the name
slot to easily create special XML elements:
name=""
If the name is an empty character string,
a pseudo node is created,
pasteXMLNode
will paste its value
as plain text.
name="!--"
Creates a comment tag, i.e.,
this will comment out all its children
.
name="![CDATA["
Creates a CDATA section and places all its children
in it.
name="*![CDATA["
Creates a CDATA section and places all its children
in it,
where the CDATA markers are
commented out by /* */
, as is used for JavaScript in XHTML.
A contructor function XiMpLe_node(...)
is available to be used instead of new("XiMpLe_node",
...)
.
There's also XiMpLe_node_old(...)
to be used instead of new("XiMpLe.node",
...)
, but you should not use that any longer.