PHP: Empty simpleXMLElement Object



I am trying to retrieve data from API, I managed to get the data however when I try to convert to SimpleXMLElement it returns empty object. when I change the header to Content-Type: text/XML I have the following data.



<DataSet xmlns="http://tempuri.org/">
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://ift.tt/tphNwY" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ITEM_CODE" type="xs:string" minOccurs="0" />
<xs:element name="ITEM_NAME" type="xs:string" minOccurs="0" />
<xs:element name="ITEM_TYPE" type="xs:string" minOccurs="0" />
<xs:element name="ITEM_DESCRIPTION" type="xs:string" minOccurs="0" />
<xs:element name="CATEGORY" type="xs:string" minOccurs="0" />
<xs:element name="ITEM_BRAND" type="xs:string" minOccurs="0" />
<xs:element name="ITEM_MODEL" type="xs:string" minOccurs="0" />
<xs:element name="GROUP_NAME" type="xs:string" minOccurs="0" />
<xs:element name="UNIT_OF_MEASURE" type="xs:string" minOccurs="0" />
<xs:element name="ALTERNATE_LOOK_UP" type="xs:string" minOccurs="0" />
<xs:element name="DOUBLE_WEB_PRICE" type="xs:decimal" minOccurs="0" />
<xs:element name="IMAGEKEY" type="xs:string" 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">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<ITEM_CODE>item1</ITEM_CODE>
<ITEM_NAME>item1</ITEM_NAME>
<ITEM_TYPE>t1</ITEM_TYPE>
<ITEM_DESCRIPTION />
<CATEGORY />
<ITEM_BRAND />
<ITEM_MODEL />
<GROUP_NAME />
<UNIT_OF_MEASURE />
<ALTERNATE_LOOK_UP />
<DOUBLE_WEB_PRICE>0.0000</DOUBLE_WEB_PRICE>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<ITEM_CODE>item2</ITEM_CODE>
<ITEM_NAME>item2</ITEM_NAME>
<ITEM_TYPE />
<ITEM_DESCRIPTION />
<CATEGORY />
<ITEM_BRAND />
<ITEM_MODEL />
<GROUP_NAME />
<UNIT_OF_MEASURE />
<ALTERNATE_LOOK_UP />
<DOUBLE_WEB_PRICE>0.0000</DOUBLE_WEB_PRICE>
</Table>
<Table diffgr:id="Table3" msdata:rowOrder="2" diffgr:hasChanges="inserted">
<ITEM_CODE>item3</ITEM_CODE>
<ITEM_NAME>item3</ITEM_NAME>
<ITEM_TYPE />
<ITEM_DESCRIPTION />
<CATEGORY />
<ITEM_BRAND />
<ITEM_MODEL />
<GROUP_NAME />
<UNIT_OF_MEASURE />
<ALTERNATE_LOOK_UP />
<DOUBLE_WEB_PRICE>0.0000</DOUBLE_WEB_PRICE>
</Table>
<Table diffgr:id="Table4" msdata:rowOrder="3" diffgr:hasChanges="inserted">
<ITEM_CODE>item4</ITEM_CODE>
<ITEM_NAME>item4</ITEM_NAME>
<ITEM_TYPE />
<ITEM_DESCRIPTION />
<CATEGORY />
<ITEM_BRAND />
<ITEM_MODEL />
<GROUP_NAME />
<UNIT_OF_MEASURE />
<ALTERNATE_LOOK_UP />
<DOUBLE_WEB_PRICE>0.0000</DOUBLE_WEB_PRICE>
</Table>


How can I get the data?


No comments:

Post a Comment