Hi,
The following is the schema
file.
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:elementType
name="note">
<xs:complexType>
<xs:sequence> <xs:element
name="to" type="xs:string" minOccur="1"
maxOccur="5"/> <xs:element
name="from" type="xs:string" minOccur="1"
maxOccur="5"/> <xs:element
name="heading" type="xs:string" minOccur="1" maxOccur="5"/>
</xs:sequence>
</xs:complexType> </xs:elementType>
The following is the corresponding
XML
<?xml version="1.0"?> <note
xsi:noNamespaceSchemaLocation="xmlsch.xsd"> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> </note>
The following is the error, i am getting while
parsing.
Error: org.xml.sax.SAXParseException: Element
type "note" must be declared. Error: org.xml.sax.SAXParseException:
Element type "to" must be declared. Error:
org.xml.sax.SAXParseException: Element type "from" must be
declared. Error: org.xml.sax.SAXParseException: Element type "heading"
must be declared. Error: org.xml.sax.SAXParseException: Element type
"body" must be declared.
Regards
Raja
|