用PHP读取Xml节点



我有一个PHP问题。我不能读取xml与PHP,并与SimpleXml。我怎么能。

我的Xml文件如下。我只想要你的公司名单。

<?xml version="1.0" encoding="utf-8"?>
<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" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <soap:Header>
    <wsa:Action>http://www.temp/Response</wsa:Action>
    <wsa:MessageID>urn:uuid:eac190a5-c833-4dee-b4ef-fa81b0bad5c1</wsa:MessageID>
    <wsa:RelatesTo>urn:uuid:834ace07-1e96-49d9-b958-3b2b87169917</wsa:RelatesTo>
    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
    <wsse:Security>
      <wsu:Timestamp wsu:Id="Timestamp-55f3bafa-087a-4971-975d-a314957b4282">
        <wsu:Created>2016-11-17T15:12:46Z</wsu:Created>
        <wsu:Expires>2016-11-17T15:17:46Z</wsu:Expires>
      </wsu:Timestamp>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <ListResponse xmlns="http://fatura.edoksis.net">
      <CompanyResult>
        <Success>1</Sonuc>
        <CompanyList>
          <Company>
            <Identifier>8380436088</Identifier>
            <RegisterTime>2016-10-21T00:00:00Z</RegisterTime>
          </Company>
          <Company>
            <Identifier>8380436088</Identifier>
            <RegisterTime>2016-10-21T00:00:00Z</RegisterTime>
          </Company>
        </CompanyList>
      </CompanyResult>
    </CompanyResult>
  </soap:Body>
</soap:Envelope>
$dom = new DOMDocument;
$dom->loadXML($response);
$books = $dom->getElementsByTagName('Identifier');
foreach ($books as $book) {
    echo $book->nodeValue ."</br>";
}

相关内容

  • 没有找到相关文章

最新更新