Additions:
Once you've got an XML Reader node you can convert it into a DOM Document node by using expand, importNode and appendChild
Deletions:
Additions:
$rnode = $reader->expand();
$dnode = $dom->importNode($rnode,true); // recursively = true
$dom->appendChild($dnode); // append childnode to DOM Document root node
$dnode = $dom->importNode($rnode,true); // recursively = true
$dom->appendChild($dnode); // append childnode to DOM Document root node
Deletions:
$node2 = $dom->importNode($node1,true); // recursively = true
$dom->appendChild($node2); // append childnode to DOM Document root node
Additions:
====Copy XMLReader node into a DOMDocument====
Once you've got an XML node you can copy or load it into a DOM Document using expand, importNode and appendChild
$node1 = $reader->expand();
$dom = new DOMDocument();
$node2 = $dom->importNode($node1,true); // recursively = true
$dom->appendChild($node2); // append childnode to DOM Document root node
Once you've got an XML node you can copy or load it into a DOM Document using expand, importNode and appendChild
$node1 = $reader->expand();
$dom = new DOMDocument();
$node2 = $dom->importNode($node1,true); // recursively = true
$dom->appendChild($node2); // append childnode to DOM Document root node
Additions:
http://ibm.com/developerworks/xml/library/x-xmlphp1/index.html
http://ibm.com/developerworks/xml/library/x-xmlphp2/index.html
http://ibm.com/developerworks/xml/library/x-xmlphp3/index.html
>>======PHP XML Reader======
====XMLReader Open====
You can either open an XML file with %%XMLReader::open($xmlfile)%% or set the xml directly with %%XMLReader::xml($xml)%%
====XMLReader Example====
%%(php)
$xmlread = new XMLReader();
$xmlread->xml($xmlresp);
$xmlread->read(); // read /Root
$xmlread->read(); // read first element /Element
while (true) { // loop through all elements at this level
echo $xmlread->name.' '.$xmlread->nodeType.PHP_EOL;
if (!$xmlread->next()) break;
}
exit;
http://ibm.com/developerworks/xml/library/x-xmlphp2/index.html
http://ibm.com/developerworks/xml/library/x-xmlphp3/index.html
>>======PHP XML Reader======
====XMLReader Open====
You can either open an XML file with %%XMLReader::open($xmlfile)%% or set the xml directly with %%XMLReader::xml($xml)%%
====XMLReader Example====
%%(php)
$xmlread = new XMLReader();
$xmlread->xml($xmlresp);
$xmlread->read(); // read /Root
$xmlread->read(); // read first element /Element
while (true) { // loop through all elements at this level
echo $xmlread->name.' '.$xmlread->nodeType.PHP_EOL;
if (!$xmlread->next()) break;
}
exit;
Deletions:
bool XMLReader::open ( string $URI [, string $encoding [, int $options= 0 ]] )
Additions:
>>http://uk.php.net/manual/en/book.xmlreader.php
>>===PHP XML Reader===
%%
bool XMLReader::open ( string $URI [, string $encoding [, int $options= 0 ]] )
%%
>>===PHP XML Reader===
%%
bool XMLReader::open ( string $URI [, string $encoding [, int $options= 0 ]] )
%%
Deletions:
>>===PHP XML===
There are a number of different ways to you can use PHP to manipulate XML.
==PHP & XML==
SimpleXml
XmlWriter