<?php
$xml = <<<XML
<DataSet>
<xs:schema id="OutDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="OutDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="BuscaSMS">
<xs:complexType>
<xs:sequence>
<xs:element name="seunum" type="xs:string" minOccurs="0" />
<xs:element name="celular" type="xs:string" minOccurs="0" />
<xs:element name="mensagem" type="xs:string" minOccurs="0" />
<xs:element name="status" type="xs:string" minOccurs="0" />
<xs:element name="datarec" type="xs:dateTime" minOccurs="0" />
<xs:element name="dataenv" type="xs:dateTime" minOccurs="0" />
<xs:element name="datastatus" type="xs:dateTime" minOccurs="0" />
<xs:element name="op" type="xs:short" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<OutDataSet xmlns="">
<BuscaSMS diffgr:id="BuscaSMS0" msdata:rowOrder="3">
<seunum>999999999</seunum>
<celular>9999999999</celular>
<mensagem>obrigado</mensagem>
<status>MO</status>
<datarec>2018-02-01T13:30:51.547-02:00</datarec>
<dataenv>2018-02-01T13:30:52.773-02:00</dataenv>
<datastatus>2018-02-01T13:30:52.773-02:00</datastatus>
<op>5</op>
</BuscaSMS>
<BuscaSMS diffgr:id="BuscaSMS1" msdata:rowOrder="4">
<seunum>99999999999</seunum>
<celular>9999999999</celular>
<mensagem>Obrigado.</mensagem>
<status>MO</status>
<datarec>2018-02-01T13:37:17.18-02:00</datarec>
<dataenv>2018-02-01T13:37:20.807-02:00</dataenv>
<datastatus>2018-02-01T13:37:20.807-02:00</datastatus>
<op>5</op>
</BuscaSMS>
</OutDataSet>
</diffgr:diffgram>
</DataSet>
XML;
$simpleXml = simplexml_load_string($xml);
var_dump($simpleXml->xpath('//BuscaSMS'));
- Output for 5.6.38, 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14, 8.4.1
- array(2) {
[0]=>
object(SimpleXMLElement)#2 (8) {
["seunum"]=>
string(9) "999999999"
["celular"]=>
string(10) "9999999999"
["mensagem"]=>
string(8) "obrigado"
["status"]=>
string(2) "MO"
["datarec"]=>
string(29) "2018-02-01T13:30:51.547-02:00"
["dataenv"]=>
string(29) "2018-02-01T13:30:52.773-02:00"
["datastatus"]=>
string(29) "2018-02-01T13:30:52.773-02:00"
["op"]=>
string(1) "5"
}
[1]=>
object(SimpleXMLElement)#3 (8) {
["seunum"]=>
string(11) "99999999999"
["celular"]=>
string(10) "9999999999"
["mensagem"]=>
string(9) "Obrigado."
["status"]=>
string(2) "MO"
["datarec"]=>
string(28) "2018-02-01T13:37:17.18-02:00"
["dataenv"]=>
string(29) "2018-02-01T13:37:20.807-02:00"
["datastatus"]=>
string(29) "2018-02-01T13:37:20.807-02:00"
["op"]=>
string(1) "5"
}
}
preferences:
66.71 ms | 410 KiB | 5 Q