我知道这已被问过很多次,但是我还没有能够得到任何建议来处理我的情况而且我已经在网上搜索并尝试了所有的事情,没有任何作用。如何使用php从这个xml字符串中提取可用性数据。
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<GetSessionAvailabilityResponse xmlns="http://www.resv5.com/webservices">
<GetSessionAvailabilityResult>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/WebAvail.xsd" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:mstns="http://tempuri.org/WebAvail.xsd" id="WebAvail" targetNamespace="http://tempuri.org/WebAvail.xsd" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="WebAvail" msdata:IsDataSet="true" msdata:Locale="en-US">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Availability">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1" type="xs:int" />
<xs:element name="PlanTime" type="xs:dateTime" />
<xs:element name="Available" type="xs:boolean" />
<xs:element name="ReturnTime" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SessionMessage">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1" type="xs:int" />
<xs:element name="Message" type="xs:string" minOccurs="0" />
<xs:element name="CardRequired" type="xs:boolean" default="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="PK_Availability" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Availability" />
<xs:field xpath="mstns:ID" />
</xs:unique>
<xs:unique name="PK_SessionMessage" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:SessionMessage" />
<xs:field xpath="mstns:ID" />
</xs:unique>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<WebAvail xmlns="http://tempuri.org/WebAvail.xsd">
<Availability diffgr:id="Availability1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<ID>1</ID>
<PlanTime>1900-01-01T19:00:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<Availability diffgr:id="Availability2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<ID>2</ID>
<PlanTime>1900-01-01T19:30:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<Availability diffgr:id="Availability3" msdata:rowOrder="2" diffgr:hasChanges="inserted">
<ID>3</ID>
<PlanTime>1900-01-01T20:00:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<Availability diffgr:id="Availability4" msdata:rowOrder="3" diffgr:hasChanges="inserted">
<ID>4</ID>
<PlanTime>1900-01-01T20:30:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<Availability diffgr:id="Availability5" msdata:rowOrder="4" diffgr:hasChanges="inserted">
<ID>5</ID>
<PlanTime>1900-01-01T21:00:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<Availability diffgr:id="Availability6" msdata:rowOrder="5" diffgr:hasChanges="inserted">
<ID>6</ID>
<PlanTime>1900-01-01T21:30:00+00:00</PlanTime>
<Available>false</Available>
</Availability>
<SessionMessage diffgr:id="SessionMessage1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<ID>1</ID>
<Message />
<CardRequired>false</CardRequired>
</SessionMessage>
</WebAvail>
</diffgr:diffgram>
</GetSessionAvailabilityResult>
</GetSessionAvailabilityResponse>
</soap:Body>
</soap:Envelope>
答案 0 :(得分:0)
这是由SOAP protocol生成的。
在此处阅读更多内容(可能重复的问题):How to use soap class in php (with example)?