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 Fri, 05 Oct 2007 07:44:47 GMT
Thanks Tom. Could you please announce the release of any new version of
DDLuitls to this mailing list? Cause i'm using it in a product that will be
out very soon.

Thanks again,

Wessam


On 10/5/07, Thomas Dudziak <tomdzk@gmail.com> wrote:
>
> On 10/3/07, Wessam Abd Rabo <wessam.abdrabo@gmail.com> wrote:
>
> > 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>
>
> This works fine for me with both Woodstox and the Java6 StAX
> implementation. Please note that you have a tiny error - the XML
> attribute for specifying the default value is called "default" not
> "defaultValue".
>
> > 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.
>
> I don't know what would be causing this, I can only guess that the
> StAX implementation that you're using, does things differently than
> the Java6 one and Woodstox (See also
> http://forum.java.sun.com/thread.jspa?threadID=5150576&messageID=9565344).
> For now, I think you can safely drop the DOCTYPE (the XML parsing in
> trunk is quite lenient). An upcoming version will btw. give the
> ability to use XML Schema instead of DTD which should do away with
> this problem.
>
> Tom
>

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