How can I find a node with a value of other node in the same level in XML? XML:
<config>
<module>
<idJS >001</idJS>
<addressPLC>41000</addressPLC>
</module>
<module>
<idJS >002</idJS>
<addressPLC>42000</addressPLC>
</module>
</config>
PHP:
<?php
$doc = new DOMDocument();
$doc->load( 'file.xml' );
$config = $doc->getElementsByTagName( "module" );
$ids = $doc->getElementsByTagName('idJS');
foreach ($ids as $id) {
if ($id->nodeValue == '001') {
echo $addressPLC;
}
}
?>
How get the nodeValue of "addressPLC" with "idJS"?