I am XML beginner. I have very basic question on xml scmeha.

I am trying to parse (SAX Parser) simple xml using schema
and got the following error. Attached are simple xml file
and schema. Please help me in this regard.

I am using  xerces parser "xerces-1_2_2".

/****************************************/
java SAXParserDemo simple.xml

  start Document
  [Fatal Error] simp.xsd:2:7: The XML declaration may
  only appear at  the very beginning of the document.
  ** Parsing error
  Line : 2
  URI : file:///home/kchapati/xerces_parser/test/simple.xml
  Message : General Schema Error: Stopping after fatal error:
            The XML declaration may only appear at the very
             beginning of the document..
  ** Parsing error
 Line : 2
 URI : file:///home/kchapati/xerces_parser/test/simple.xml
 Message : General Schema Error: Can't get back Schema
           document's root
           element :file:///home/kchapati/xerces_parser/test/simp.xsd.
           grammar not found
 ** Parsing error
 Line : 2
 URI : file:///home/kchapati/xerces_parser/test/simple.xml
 Message : Element type "Top" must be declared.
 start element : Top
 ** Parsing error
 Line : 3
 URI : file:///home/kchapati/xerces_parser/test/simple.xml
 Message : Element type "Telephone" must be declared.
 start element : Telephone
 end element : Telephone
end element : Top
end Document

/*******************************************

/------- xml file  "simple.xml" -------------------/

<?xml version="1.0" encoding="UTF-8"?>
<Top xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
     xsi:noNamespaceSchemaLocation='simp.xsd' >
<Telephone> 9725074850 </Telephone>
</Top>

/%%%%%%%%%%%%% schema  "simp.xsd" %%%%%%%%%%%%%%/

<?xml version="1.0" encoding="UTF-8"?>
<schema>

<element name="Top" >
  <element name="Telephone" type="string" />
</element>

</schema>


_____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com



Reply via email to