Thank you very much for your quick response. I really appreciate your help. I haven't fixed the problem yet.

I removed empty lines/spaces in schema file.
Now, I got a different error message.
Please help me. I am using (SAX) xerces-1_2_2 parser.
I am using SAX, I don't understand why I got DOMParser error.
BTW, I have included "xerces.jar" in my class path.

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

start Document
java.lang.NoSuchMethodError: org.w3c.dom.Document: method
createElementNS(Ljava/lang/String;Ljava/lang/String;)
Lorg/w3c/dom/Element; not found
at org.apache.xerces.parsers.DOMParser.startElement
(DOMParser.java:1033)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:705)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:989)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XMLValidator.java:2058)
at org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttributes(XMLValidator.java:1946)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:697)
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1852)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1000)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at SAXParserDemo.main(SAXParserDemo.java:31)


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


From: "Arnold, Curt" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
CC: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject: RE: basic question on xml scmeha - help me
Date: Mon, 4 Dec 2000 14:13:11 -0700

A couple of issues:

The xerces-dev list is dead, use the xerces-j-dev (or xerces-c-dev for C++ related questions) list instead.

The XML declaration must be the very first thing in the file (not even line feeds or white space) before it. It would appear that you have the XML declaration (<?xml...?>) on the second line.

You did not declare a namespace in your schema file,

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/1999/XMLSchema";>
<element name="Top" >
   <element name="Telephone" type="string" />
</element>
</schema>


If you are just trying to learn about schema validation, I would recommend that you download XSV from http://www.w3.org/XML/Schema since it supports the 2 Nov Candidate Recommendation and
substantially more features than Xerces-J currently does. In that case, the following files will work:


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

----------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200010//EN" "http://www.w3.org/2000/10/XMLSchema.xsd";>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema";>
<element name="Top" >
<complexType>
<sequence>
<element name="Telephone" type="string" />
</sequence>
</complexType>
</element>
</schema>




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



Reply via email to