yub yub les gens, je récupère un XML ayant cette forme :
et moi je voudrai récupérer les deux attributs : ID_AGENT et ID_UO
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <ChargerAgentResponse xmlns="http://tempuri.org/"> <ChargerAgentResult> <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns=""> <s:Schema id="RowsetSchema"> <s:AttributeType name="NUMERO_POSTE_TEL" rs:number="8" rs:writeunknown="true"> <s:datatype dt:type="string" dt:maxlength="-1" rs:maybenull="True"/> </s:AttributeType> </s:Schema> <rs:data> <z:row ID_AGENT="60387" ID_UO="128" /> </rs:data> </xml> </ChargerAgentResult> </ChargerAgentResponse> </soap:Body> </soap:Envelope>
alors j'ai fais ceci :
mais ça n'affiche que
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <?php $doc = new DOMDocument(); $doc->loadXML($xml); $xpath = new DOMXPath($doc); foreach ($xpath->query('//rs:data') as $node) { foreach ($node->childNodes as $child_node) { if (!$child_node instanceof DOMText) echo $child_node->nodeName; } }... je n'obtiens pas l'attribut... une idée siouplais ?z:row
merci d'avance
Partager