db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wessam Abd Rabo" <wessam.abdr...@gmail.com>
Subject Re: Urgent: XMLStreamException
Date Wed, 03 Oct 2007 21:31:49 GMT
Hi,

What could be going wrong with this file? I don't see anything.
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
<database name="testdb">
  <table name="author">
    <column name="author_id"
            type="INTEGER"
            primaryKey="true"
            required="true"/>
    <column name="name"
            type="VARCHAR"
            size="50"
            required="true"/>
    <column name="organisation"
            type="VARCHAR"
            size="50"
            required="false"/>
  </table>

  <table name="book">
    <column name="book_id"
            type="INTEGER"
            required="true"
            primaryKey="true"
            autoIncrement="true"/>
    <column name="isbn"
            type="VARCHAR"
            size="15"
            required="true"/>
    <column name="author_id"
            type="INTEGER"
            required="true"/>
    <column name="title"
            type="VARCHAR"
            size="255"
            defaultValue="N/A"
            required="true"/>

    <foreign-key foreignTable="author">
      <reference local="author_id" foreign="author_id"/>
    </foreign-key>

    <index name="book_isbn">
      <index-column name="isbn"/>
    </index>
  </table>
</database>



Notice that it is the exception is caused by XMLStreamReader.next().
The javadoc of this method is:

> Get next parsing event - a processor may return all contiguous character
> data in a single chunk, or it may split it into several chunks. If the
> property javax.xml.stream.isCoalescing is set to true element content must
> be coalesced and only one CHARACTERS event must be returned for contiguous
> element content or CDATA Sections. By default entity references must be
> expanded and reported transparently to the application. An exception will be
> thrown if an entity reference cannot be expanded. If element content is
> empty (i.e. content is "") then no CHARACTERS event will be reported.
>
> Given the following XML:
> <foo><!--description-->content
> text<![CDATA[<greeting>Hello</greeting>]]>other content</foo>
> The behavior of calling next() when being on foo will be:
> 1- the comment (COMMENT)
> 2- then the characters section (CHARACTERS)
> 3- then the CDATA section (another CHARACTERS)
> 4- then the next characters section (another CHARACTERS)
> 5- then the END_ELEMENT
>
> *NOTE:* empty element (such as <tag/>) will be reported with two separate
> events: START_ELEMENT, END_ELEMENT - This preserves parsing equivalency of
> empty element to <tag></tag>. This method will throw an
> IllegalStateException if it is called after hasNext() returns false.
>
By debugging, i found that javax.xml.stream.isCoalescing is set to true. I
don't understand what does this does and what should i do if it's true, as
described by the javadoc. Can you help me understand this? Maybe this can
help solve the problem.
you see, this method throws a XMLStreamException: if there is an error
processing the underlying XML source.

Wessam




On 10/3/07, Thomas Dudziak <tomdzk@gmail.com> wrote:
>
> On 10/2/07, Wessam Abd Rabo <wessam.abdrabo@gmail.com> wrote:
>
> > I get the following exception:
> >
> > org.apache.ddlutils.io.DdlUtilsXMLException:
> > javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,74]
> > Message: db.apache.org
> >  at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:278)
> >  at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:207)
> >  at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:171)
> >
> > Caused by: javax.xml.stream.XMLStreamException: ParseError at
> > [row,col]:[2,74]
> > Message: db.apache.org
> >  at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:560)
> >  at org.apache.ddlutils.io.DatabaseIO.read(DatabaseIO.java:262)
> >  ... 26 more
> >
> > what  could be going wrong? Could it be the XML file that am reading?
>
> That seems to be the case. Check your XML file, line 2, character 74
> (as indicated by the exception message).
>
> Tom
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message