# NOT RUN {
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"]])
# }
Run the code above in your browser using DataLab