Here is an example of the XML I'm using:
<LISTING diffgr:id="LISTING1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<ID>ACCAMAQU0470001P</ID>
<DATECREA>2013-01-28T09:45:21+01:00</DATECREA>
<DATEMAJ>2014-01-09T17:41:25+01:00</DATEMAJ>
...
</LISTING>
...
In the PHP code, I am here:
$document_xml = new DOMDocument();
$document_xml->loadXML($retour['any']);
$elements = $document_xml->getElementsByTagName('LISTING');
while ($elements->item($i)) {
$element = $elements->item($i);
$list = $element->childNodes;
$idtest = $element->getElementsByTagName('DATEMAJ');
$idElem = $element->getElementsByTagName('ID');
foreach($idElem as $idSirtaq){
$idList[] = $idSirtaq->firstChild->nodeValue;
}
foreach ($idtest as $test) {
...
}
...
}
I would like to get the value of the nodes "ID" and "DATEMAJ". I know to get the value of "DATEMAJ" with $test->firstChild->nodeValue, but not how to get the value of node "ID".
Could you help me? Thanks!
source
share