我使用libxml2和C来验证以下xml文档:
<?xml version="1.0"?>
<CHARMS ver="0.02">
<Header seqN="1184" type="BANDWIDTH"/>
<Bandwidth Band="2.130000" Latency="12.234000" Jitter="123.456078"/>
<Trailer method="md5" Digest="838da77ca83abd70a13a18b82afb4820"/>
</CHARMS>
并且xsd文件包含:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CHARMS">
<xs:complexType>
<xs:sequence>
<xs:element name="Header">
<xs:complexType>
<xs:attribute name="seqN" type="xs:int"/>
<xs:attribute name="type" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:choice>
<xs:sequence>
<xs:element name="Bandwidth">
<xs:complexType>
<xs:attribute name="Latency" type="lat_unit"/>
<xs:attribute name="Jitter" type="jit_unit"/>
<xs:attribute name="Band" type="bps"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:choice>
<xs:element name="Trailer">
<xs:complexType>
<xs:attribute name="method" use="required" type="xs:string"/>
<xs:attribute name="Digest" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ver" use="required" type="xs:decimal"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="lat_unit">
<xs:restriction base="xs:decimal"/>
</xs:simpleType>
<xs:simpleType name="jit_unit">
<xs:restriction base="xs:decimal"/>
</xs:simpleType>
<xs:simpleType name="bps">
<xs:restriction base="xs:decimal"/>
</xs:simpleType>
<xs:simpleType name="address">
<xs:restriction base="xs:string">
<xs:pattern value="((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]).){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
但是当我尝试验证它时,验证工作但我收到以下错误消息:
test.xml:2: element CHARMS: Schemas validity error : Element 'CHARMS': No matching global declaration available for the validation root.
此错误消息的含义是什么?