Topic by Steven Naek
Hello,
I have the following reponse in xml format:
<n0:Rows>
<n0:Row>Plomberie</n0:Row>
<n0:Row>Electricité</n0:Row>
<n0:Row>Chauffage / Climatisation / Ventilation</n0:Row>
<n0:Row>Admin</n0:Row>
<n0:Row>Eclairage</n0:Row>
</n0:Rows>
I used the following code:
$matches = array();
preg_match("/<n0:Rows>(.*)?<\/n0:Rows>/", html_entity_decode($xml), $matches);
return $matches[1];
I was able to obtain the following:
<n0:Row>Plomberie</n0:Row>
<n0:Row>Electricité</n0:Row>
<n0:Row>Chauffage / Climatisation / Ventilation</n0:Row>
<n0:Row>Admin</n0:Row>
<n0:Row>Eclairage</n0:Row>
But i can not separate the elements from the nodes. I have try using DOM and SIMPLEXML. They don't work in my script. How to get the elements? Please note that the number of nodes are not definite. Thanks.