OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Simple Schema

[ Lists Home | Date Index | Thread Index ]
  • To: <xml-dev@lists.xml.org>
  • Subject: Re: [xml-dev] Simple Schema
  • From: "rajac" <rajac@ncmr.co.in>
  • Date: Mon, 11 Feb 2002 04:59:19 +0530
  • References: <5C9461BDD6ABD511815500D0B7B7A0E2247F6F@nt_2.asset-internal>

Hi KRUMPOLEC Martin / Henry S. Thompson,
   The things are not still working. I am using Xerces2.0.0(Java version). I
have all the setup in solaris. I have written a java program which parses
the XML(i am not opening on a Browser, i just run the java program). The
same thing works fine when i use DTD in place of XML-schema. Is there any
dll's to be installed when i use XML-Schema?.  I have given u the XML file
and .XSD file below. I think the XML file is not able to locate the Schema
file(.xsd).

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="note">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="to" type="xs:string" minOccur="1" maxOccur="5"/>
        <xs:element name="heading" type="xs:string" minOccur="1"
maxOccur="5"/>
        <xs:element name="body" type="xs:string" minOccur="1" maxOccur="5"/>
      </xs:sequence>
    </xs:complexType>
</xs:element>
</xs:schema>

The following is the corresponding XML file.
<?xml version="1.0"?>
<note xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="xmlsch.xsd">
<to>Tove</to>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

The following is the error thrown while parsing(ie while running the java
file).
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 "heading" must be
declared.
Error:  org.xml.sax.SAXParseException: Element type "body" must be declared.
<note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="xmlschbak.xsd">

Regards
Raja







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS