xmlToS4.RdThis 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.
The object obj whose slots have been modified.
txt = paste0("<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"]])
#> An object of class "part"
#> Slot "name":
#> [1] "ABC"
#>
#> Slot "type":
#> [1] "XYZ"
#>
#> Slot "cost":
#> [1] 3.54
#>
#> Slot "status":
#> [1] "available"
#>