simplexml_load_string():实体:第1行:解析器错误:预期开始标记,未找到“ <”

时间:2018-11-14 13:25:11

标签: php xml dataset simplexml

所以,我很困惑。我知道XML是有效的,因为它可以在我尝试过的所有地方进行验证,但是这种XML:

<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns="http://webservices.theshootingwarehouse.com/smart/Images.asmx">
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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="MFGNO" type="xs:int" minOccurs="0" />
                <xs:element name="Logo" type="xs:base64Binary" minOccurs="0" />
                <xs:element name="LogoDate" type="xs:dateTime" 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">
        <MFGNO>1</MFGNO>
        <Logo>...truncated...</Logo>
        <LogoDate>2012-07-30T00:00:00+00:00</LogoDate>
      </Table>
    </NewDataSet>
  </diffgr:diffgram>
</DataSet>

像这样调用时不起作用:

$data = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE);

出现错误:

simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found

我要疯了!似乎没有押韵或理由...

-山姆

0 个答案:

没有答案