db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Davis <da...@guydavis.ca>
Subject Re: Parser error from DatabaseIO.read()
Date Tue, 14 Feb 2006 14:41:09 GMT
I ran into this last week I think.  With help from the list, I found I 
needed to add the following to the top of the schema XML file:

<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">

Then make sure that your root <database> tag has a name attribute.  
After that, I was able to successfully load the schema into empty 
Oracle, SQLServer, and MySQL databases.

Good luck,
Guy

Vignesh Swaminathan wrote:

>Hi,
>
>Since I took a new update from the SVN yesterday, I have a parser error
>popping when reading in a model from a file. This file is not hand
>created by generated using DDLUtils. The model was written from a MySQL
>5.1 database (cordyshr) and the test was to create a new database of the
>same model but with different DB name (testdb). The code which gives the
>parser error is,
>
>public void readModelFromFile(String inputFile)
>{
>	DatabaseIO dbIO = new DatabaseIO();
>	dbModel = dbIO.read(inputFile);
>}
>
>The parser error is,
>
>Feb 14, 2006 10:05:07 AM org.apache.commons.digester.Digester error
>SEVERE: Parse Error at line 1 column 29: Document root element
>"database", must match DOCTYPE root "null".
>org.xml.sax.SAXParseException: Document root element "database", must
>match DOCTYPE root "null".
>	at
>com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar
>seException(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknow
>n Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unk
>nown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unk
>nown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementS
>pecified(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartE
>lement(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement
>(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
>canStartElement(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDi
>spatcher.scanRootElementHook(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$F
>ragmentContentDispatcher.dispatch(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
>canDocument(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unkn
>own Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unkn
>own Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
>Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unkno
>wn Source)
>	at
>org.apache.commons.digester.Digester.parse(Digester.java:1704)
>	at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:146)
>	at TestDDL.readModelFromFile(TestDDL.java:54)
>	at TestDDL.main(TestDDL.java:137)
>Feb 14, 2006 10:05:07 AM org.apache.commons.digester.Digester error
>SEVERE: Parse Error at line 1 column 29: Document is invalid: no grammar
>found.
>org.xml.sax.SAXParseException: Document is invalid: no grammar found.
>	at
>com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar
>seException(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknow
>n Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unk
>nown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unk
>nown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartE
>lement(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement
>(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
>canStartElement(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDi
>spatcher.scanRootElementHook(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$F
>ragmentContentDispatcher.dispatch(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
>canDocument(Unknown Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unkn
>own Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unkn
>own Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
>Source)
>	at
>com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unkno
>wn Source)
>	at
>org.apache.commons.digester.Digester.parse(Digester.java:1704)
>	at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:146)
>	at TestDDL.readModelFromFile(TestDDL.java:54)
>	at TestDDL.main(TestDDL.java:137)
>
>The parser error is suppressed with the following change,
>
>public void readModelFromFile(String inputFile)
>{
>	DatabaseIO dbIO = new DatabaseIO();
>	dbIO.setValidateXml(false);
>	dbModel = dbIO.read(inputFile);
>}
>
>I have attached the input file containing the schema, this does not
>prevent me going forward as I observed that even if I do not set
>validate off, the parser error does not affect the reading in of the
>model, the code to create a new database just works fine.
>
>Regards
>Vignesh Swaminathan
>
><vignesh/>
>"Winning solutions find the right balance between market needs and
>technical needs"
>
>
>***************************************************************************************************
>The information in this message is confidential and may be legally  privileged. 
>It is intended solely for the addressee. Access to this message by anyone else is 
>unauthorized. If you are not the intended recipient, any disclosure, copying, or 
>distribution of the message, or any action or omission taken by you in reliance 
>on it is prohibited and may be unlawful. Please immediately contact the sender if 
>you have received this message in error. This email does not constitute any 
>commitment  from Cordys Holding BV or any of its subsidiaries except when 
>expressly agreed in a written agreement between the intended recipient and 
>Cordys Holding BV or its subsidiaries.
> ***************************************************************************************************
>
>  
>


Mime
View raw message