[jdom-interest] parsing problem while using SAXBuilder
aruna konreddy
konreddy at hotmail.com
Fri Mar 23 18:56:35 PST 2001
I downloaded the latest version of xerces.jar from apache and
it fixed the problem.
- Aruna
At 07:55 AM 3/23/2001, you wrote:
>I am trying to build a JDOM document using the SAXBuilder.
>I want the SAXBuilder to validate the XML file before building
>document and the SAXBuilder complains that it can't find the root
>element. Can you tell me what the problem is? Thanks for your help!!!
>
>(Below are the xml file, xml schema and the errors)
>XML File:
>"<?xml version="1.0" encoding="UTF-8"?>
><Book xmlns:xsi="http://www.w3.org/2000/10/XMLSchemainstance"
> xsi:noNamespaceSchemaLocation="/home/yen/ex/jdomexamples/simple.xsd"
> <Title>ALTOVA - The XML Spy Company</Title>
> <Author>Joe Smith</Author>
></Book>
>
>XML Schema:
><?xml version="1.0" encoding="UTF-8"?>
><xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
> <xsd:element name="Book">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Title" type="xsd:string"/>
> <xsd:element name="Author" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
></xsd:schema>
>
>Errors:
>Exception in thread "main" org.jdom.JDOMException: Error on line 1:
>Element type "Book" must be declared.
> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:407)
> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:499)
> at ex.jdomexamples.TestSchema.main(TestSchema.java:54)
>Root cause: org.xml.sax.SAXParseException: Element type "Book" must be
>declared.
> at
>org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1008)
> at
>org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1236)
> at
>org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:2673)
> at
>org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:818)
> 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:900)
> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:395)
> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:499)
> at ex.jdomexamples.TestSchema.main(TestSchema.java:54)
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
Chad La Joie "Only a man who can not conquer
IT Specialist his deficiencies feels the need to
IS&C - WARD convince the world he has none"
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
More information about the jdom-interest
mailing list