XML Gurus,
我在使用XSD文件在PHP中验证DOM文档时遇到了问题。有什么想法吗?
示例XML
<Message xmlns="http://www.org.org/schema/DOCUMENT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="010" release="006" xsi:schemaLocation="http://www.org.org/schema/DOCUMENT SS_DOCUMENT_XML_10_6MU.xsd">
<Header>
<To Qualifier="P">3365310</To>
<From Qualifier="D">6438058169001</From>
<MessageID>52e2a28345cf152e2a2836e3c1</MessageID>
<SentTime>2014-01-24T09:27:31.5Z</SentTime>
<PrescriberOrderNumber>PON12341</PrescriberOrderNumber>
</Header>
<Body>
<!-- more content here, removed for sample -->
</Body>
</Message>
示例XSD
<xs:schema xmlns="http://www.org.org/schema/DOCUMENT" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.org.org/schema/DOCUMENT" elementFormDefault="qualified">
<!-- Message -->
<xs:element name="Message" type="MessageType"/>
<xs:complexType name="MessageType">
<xs:sequence>
<xs:element name="Header" type="HeaderType"/>
<xs:element name="Body" type="BodyType"/>
</xs:sequence>
</xs:complexType>
<!-- More complex types are here, removed for sample -->
</xs:schema>
示例PHP
$doc->schemaValidate('SS_DOCUMENT_XML_10_6MU.xsd')
错误消息
Message: DOMDocument::schemaValidate(): Element 'Body': No matching global declaration available for the validation root.