All work with the xmlTree
API starts with the document, whether
you're using existing data or starting from scratch. There are three
ways to obtain an xmlDoc
object:
xmlTreeNewDocFromFile()
, here)xmlTreeNewDocFromString()
, here)xmlTreeNewDoc()
,
here)
EXAMPLE<$rawXml = "<simpleExample>read me</simpleExample>">
<$doc = (xmlTreeNewDocFromString($xmlRaw))>
<$root = (xmlTreeGetRootElement($doc))>
...
<$doc = (xmlTreeNewDocFromFile( 'sample.xml'))>
<$xpath= (xmlTreeNewXPath($doc))>
...
<$doc = (xmlTreeNewDoc( '1.0'))>
<$root = (xmlTreeNewElement($doc, 'rootNode'))>
SEE ALSOxmlTreeNewDoc
,
xmlTreeNewDocFromFile
,
xmlTreeNewDocFromString