New nodes are added to an xmlTree
by various new
functions. They all take a parent, which specifies where the new node
should be created, and either a name and optional content (in the case of
elements and attributes), or just content (comments, CDATA, etc).
EXAMPLE<$doc = (xmlTreeNewDoc( '1.0'))>
<$root = (xmlTreeNewElement($doc, 'rootNode'))>
<$name = (xmlTreeNewElement($root, 'name', 'John Doe'))>
<$age = (xmlTreeNewElement($root, 'age', '23'))>
<$ret = (xmlTreeNewAttribute($age, 'type', 'years'))>
<$output = (xmlTreePrintDoc($doc, 'INDENT'))>
output is $output
SEE ALSOxmlTreeNewElement
,
xmlTreeNewPI
,
xmlTreeNewText
,
xmlTreeNewCDATA
,
xmlTreeNewComment
,
xmlTreeNewAttribute
,
xmlTreeNewNs