xsd - XML Schema - cannot find the declaration of element -
xml file:
<?xml version="1.0" encoding="utf-8"?> <rootitem xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="schema.xsd"> <product category="software" type="individual" currentlyoffered="y"> <tid>725</tid> <tname>ms office</tname> <reviewdate>2017-12-05</reviewdate> <note staffid="ee21kfj">need specify windows version</note> <note staffid="ef23mls">is there price update?</note> </product> <product category="hardware" type="individual" currentlyoffered="tbc"> <tid>511</tid> <tname>mouse</tname> <reviewdate>2016-09-26</reviewdate> <note staffid="fh26eij">need ensure ... minors</note> <note staffid="mm25por">need check ... this</note> </product> </rootitem>
xml schema:
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <!-- definition of simple elements --> <xs:element name="tid" type="xs:positiveinteger"/> <xs:element name="tname" type="xs:string"/> <xs:element name="reviewdate" type="xs:date"/> <xs:element name="note" type="xs:string"/> <!-- definition of attributes --> <xs:attribute name="category" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> <xs:attribute name="currentlyoffered" type="xs:string"/> <xs:attribute name="staffid"> <xs:simpletype> <!-- rules --> </xs:simpletype> </xs:attribute> <!-- definition of complex elements --> <xs:element name="product"> <xs:complextype> <xs:sequence> <!-- rules --> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="rootitem"> <xs:complextype> <!-- rules --> </xs:complextype> </xs:element> </xs:schema>
and response is:
"cannot find declaration of element 'rootitem'.
any ideas?
your xml instance uses default namespace xmlns="http://www.w3schools.com"
not defined in schema. don't know part of data changeable, either have remove namespace in xml or add <xs:element name="rootitem" xmlns="http://www.w3schools.com">
in schema.
(have @ comment of michael kay right action correct schema file mentioned)
Comments
Post a Comment