xmlToS4

0th

Percentile

General mechanism for mapping an XML node to an S4 object

This generic function and its methods recursively process an XML node and its child nodes ( and theirs and so on) to map the nodes to S4 objects.

This is the run-time function that corresponds to the makeClassTemplate function.

Keywords
programming, IO
Usage
xmlToS4(node, obj = new(xmlName(node)), ...)
Arguments
node

the top-level XML node to convert to an S4 object

obj

the object whose slots are to be filled from the information in the XML node

additional parameters for methods

Value

The object obj whose slots have been modified.

See Also

makeClassTemplate

Aliases
  • xmlToS4
  • xmlToS4,XMLInternalNode-method
Examples
# NOT RUN {
 txt =
 "<doc><part><name>ABC</name><type>XYZ</type><cost>3.54</cost><status>available</status></part></doc>"
 doc = xmlParse(txt)

 setClass("part", representation(name = "character",
                                 type = "character",
                                 cost = "numeric",
                                 status= "character"))
 xmlToS4(xmlRoot(doc)[["part"]])
# }
Documentation reproduced from package XML, version 3.98-1.19, License: BSD_2_clause + file LICENSE

Community examples

Looks like there are no examples yet.