users@fi.java.net

Re: [Fwd: Re: decoding failure]

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Tue, 17 Apr 2007 14:04:38 +0200

Hello Ilia,

I checked your code.
When serializing xml document using StreamingSerializer.write(Document),
it calls following StAX method sequence:

1) writeStartDocument()
2) writeCharacters("\n")
3) writeStartElement("a")
4) writeCharacters("\n")
5) writeEndElement()
6) writeEndDocument()

The problems is caused by 2nd step. As characters are written outside
the element scope. StAX serializer is not strict and doesn't care about
that, but when you deserialize it with SAX - it throws exception,
because doesn't expect characters in this place.

Actually, there is workaround for such problem, you will need to set
SAXDocumentParser.setParseFragments(true);

in that case FI SAX parser will let 2nd step pass.

WBR,
Alexey.

tghfbt_at_gmail.com wrote:
> Attached.
> nux can be found at http://dsd.lbl.gov/nux/
> The problem with the fastinfoset is that file encoded with Stax
> couldn't be decoded with Sax.
>
> On 4/14/07, Oleksiy Stashok <Oleksiy.Stashok_at_sun.com> wrote:
>> Ilia,
>>
>> FI file you sent is wrong from the very beginning...
>> Can you pls. send you encoder code and source xml document, that will
>> help me to reproduce the bug.
>>
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>> tghfbt_at_gmail.com wrote:
>> > Oleksiy,
>> >
>> > File attached. The problem is that fastinfoset file encoded with SAX
>> > cannot be decoded with STax.
>> >
>> >
>> >
>> > On 4/13/07, Oleksiy Stashok <Oleksiy.Stashok_at_sun.com> wrote:
>> >>
>> >>
>> >>
>> >> ---------- Forwarded message ----------
>> >> From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
>> >> To: users_at_fi.dev.java.net
>> >> Date: Fri, 13 Apr 2007 10:29:46 +0200
>> >> Subject: Re: decoding failure
>> >> Hello Ilia,
>> >>
>> >> can you pls attach xml document.
>> >>
>> >> WBR,
>> >> Alexey.
>> >>
>> >> tghfbt_at_gmail.com wrote:
>> >> > Hi,
>> >> >
>> >> > I have problem with decoding simple xml document.
>> >> > Exception is below.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Ilia Iourovitski
>> >> >
>> >> >
>> >> > org.jvnet.fastinfoset.FastInfosetException: Illegal state when
>> >> > decoding a child of a DII
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.processDII(SAXDocumentParser.java:547)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:417)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:368)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:343)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:584)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:638)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
>>
>> >>
>> >> >
>> >> > at Fi.fi2xml(Fi.java:59)
>> >> > at Fi.main(Fi.java:21)
>> >> > ERROR: 'Illegal state when decoding a child of a DII'
>> >> > Exception in thread "main"
>> javax.xml.transform.TransformerException:
>> >> > org.jvnet.fastinfoset.FastInfosetException: Illegal state when
>> >> > decoding a child of a DII
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:650)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
>>
>> >>
>> >> >
>> >> > at Fi.fi2xml(Fi.java:59)
>> >> > at Fi.main(Fi.java:21)
>> >> > Caused by: org.jvnet.fastinfoset.FastInfosetException: Illegal
>> state
>> >> > when decoding a child of a DII
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:347)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:584)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:638)
>>
>> >>
>> >> >
>> >> > ... 3 more
>> >> > ---------
>> >> > org.jvnet.fastinfoset.FastInfosetException: Illegal state when
>> >> > decoding a child of a DII
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:347)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:584)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:638)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
>>
>> >>
>> >> >
>> >> > at Fi.fi2xml(Fi.java:59)
>> >> > at Fi.main(Fi.java:21)
>> >> > ---------
>> >> > org.jvnet.fastinfoset.FastInfosetException: Illegal state when
>> >> > decoding a child of a DII
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.processDII(SAXDocumentParser.java:547)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:417)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:368)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.xml.fastinfoset.sax.SAXDocumentParser.parse(SAXDocumentParser.java:343)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:584)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:638)
>>
>> >>
>> >> >
>> >> > at
>> >> >
>> >>
>> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
>>
>> >>
>> >> >
>> >> > at Fi.fi2xml(Fi.java:59)
>> >> > at Fi.main(Fi.java:21)
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe_at_fi.dev.java.net
>> >> > For additional commands, e-mail: users-help_at_fi.dev.java.net
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe_at_fi.dev.java.net
>> >> For additional commands, e-mail: users-help_at_fi.dev.java.net
>> >>
>> >>
>> >>
>>
> ------------------------------------------------------------------------
>
> <a>
> </a>
>