xml - Invoking libxml2 for XSD validation -
i using libxml2 c validate following xml document:
<?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>
and xsd file contains:
<?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>
but when try validate it, validation works receive following error message:
test.xml:2: element charms: schemas validity error : element 'charms': no matching global declaration available validation root.
what's meaning of error message ?
Comments
Post a Comment