You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Ken Weiner <kw...@gmail.com> on 2005/12/20 10:22:52 UTC
Problem validating XML
Since XML validation was enabled by default in DatabaseIO, I have run into
an error when I run DdlUtils. My database XML file and resulting stack
track are shown below. Do I need to modify or add something to my XML file
or is there a problem with the DTD?
<?xml version="1.0"?>
<database name="database-name">
...(the table definitions)
</database>
SEVERE: Parse Error at line 10 column 33: 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.createSAXParseException
(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(
ErrorHandlerWrapper.java:172)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:316)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified
(XMLDTDValidator.java:1652)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement
(XMLDTDValidator.java:1931)
at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(
XMLDTDValidator.java:795)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement
(XMLDocumentFragmentScannerImpl.java:878)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook
(XMLDocumentScannerImpl.java:1157)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch
(XMLDocumentFragmentScannerImpl.java:1794)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument
(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(
XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(
XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(
XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(
AbstractSAXParser.java:1242)
at org.apache.commons.digester.Digester.parse(Digester.java:1685)
at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:190)
Re: Problem validating XML
Posted by Thomas Dudziak <to...@gmail.com>.
On 12/20/05, Ken Weiner <kw...@gmail.com> wrote:
> Since XML validation was enabled by default in DatabaseIO, I have run into
> an error when I run DdlUtils. My database XML file and resulting stack
> track are shown below. Do I need to modify or add something to my XML file
> or is there a problem with the DTD?
>
> <?xml version="1.0"?>
> <database name="database-name">
> ...(the table definitions)
> </database>
Well, the problem is that you haven't specified a DTD at all, and the
XML parser that you're using does not like that.
You can turn XML validation off at the DatabaseIO class via the
setValidateXml method:
http://svn.apache.org/viewcvs.cgi/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java?view=markup
Tom
Re: Problem validating XML
Posted by Thomas Dudziak <to...@gmail.com>.
On 12/20/05, Ken Weiner <kw...@gmail.com> wrote:
> It would help new users like me if there was a sample XML file included with
> the proper DOCTYPE. If there is another one in there, I couldn't find it.
> This could also be added to the home page where there is a sample XML
> fragment shown.
There is a yet-to-be-done page in the docs for the DTD format which
I'll have to write before the release of the 1.0.
Tom
Re: Problem validating XML
Posted by Ken Weiner <kw...@gmail.com>.
It would help new users like me if there was a sample XML file included with
the proper DOCTYPE. If there is another one in there, I couldn't find it.
This could also be added to the home page where there is a sample XML
fragment shown.
I changed my doctype to
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
per your comment.
Thanks.
On 12/20/05, Thomas Dudziak <to...@gmail.com> wrote:
>
> On 12/20/05, Ken Weiner <kw...@gmail.com> wrote:
> > I think I figured it out after reading the code in
> LocalEntityResolver. I
> > added the following line to my XML file and I don't get anymore
> validation
> > errors:
> > <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
> >
> > Is that the appropriate DOCTYPE declaration?
>
> I think somewhere there should be a ".dtd", but I don't have a sample
> at hand currently.
>
> > Should the file src/test-input/datamodel.xml be changed to include a
> DOCTYPE
> > declaration?
>
> Actually, this is old stuff, I only haven't gotten around to removing it.
>
> Tom
>
Re: Problem validating XML
Posted by Thomas Dudziak <to...@gmail.com>.
On 12/20/05, Ken Weiner <kw...@gmail.com> wrote:
> I think I figured it out after reading the code in LocalEntityResolver. I
> added the following line to my XML file and I don't get anymore validation
> errors:
> <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
>
> Is that the appropriate DOCTYPE declaration?
I think somewhere there should be a ".dtd", but I don't have a sample
at hand currently.
> Should the file src/test-input/datamodel.xml be changed to include a DOCTYPE
> declaration?
Actually, this is old stuff, I only haven't gotten around to removing it.
Tom
Re: Problem validating XML
Posted by Ken Weiner <kw...@gmail.com>.
I think I figured it out after reading the code in LocalEntityResolver. I
added the following line to my XML file and I don't get anymore validation
errors:
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
Is that the appropriate DOCTYPE declaration?
Should the file src/test-input/datamodel.xml be changed to include a DOCTYPE
declaration?
-Ken
On 12/20/05, Ken Weiner <kw...@gmail.com> wrote:
>
> Since XML validation was enabled by default in DatabaseIO, I have run into
> an error when I run DdlUtils. My database XML file and resulting stack
> track are shown below. Do I need to modify or add something to my XML file
> or is there a problem with the DTD?
>
> <?xml version="1.0"?>
> <database name="database-name">
> ...(the table definitions)
> </database>
>
> SEVERE: Parse Error at line 10 column 33: 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.createSAXParseException
> (ErrorHandlerWrapper.java:236)
> at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(
> ErrorHandlerWrapper.java:172)
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
> XMLErrorReporter.java:382)
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
> XMLErrorReporter.java:316)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified
> (XMLDTDValidator.java:1652)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement
> (XMLDTDValidator.java:1931)
> at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(
> XMLDTDValidator.java:795)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement
> (XMLDocumentFragmentScannerImpl.java:878)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook
> (XMLDocumentScannerImpl.java:1157)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch
> (XMLDocumentFragmentScannerImpl.java:1794)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument
> (XMLDocumentFragmentScannerImpl.java:368)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> (XML11Configuration.java:834)
> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> (XML11Configuration.java:764)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(
> XMLParser.java:148)
> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(
> AbstractSAXParser.java:1242)
> at org.apache.commons.digester.Digester.parse(Digester.java:1685)
> at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:190)
>
>