|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re:Oleksiy Stashok wrote:
> 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") If you are using an XML StAX implementation, like SJSXP (i do not know what Woodstox does, the JSR spec is of no help!), and write characters other than white space characters (or ones that conform to comment or PI productions) then it will produce a non-well-formed XML document and an conforming XML parser will barf when parsing the document. Paul. > 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@... 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@...> 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@... 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@...> wrote: >>> >> >>> >> >>> >> >>> >> ---------- Forwarded message ---------- >>> >> From: Oleksiy Stashok <Oleksiy.Stashok@...> >>> >> To: users@... >>> >> Date: Fri, 13 Apr 2007 10:29:46 +0200 >>> >> Subject: Re: decoding failure >>> >> Hello Ilia, >>> >> >>> >> can you pls attach xml document. >>> >> >>> >> WBR, >>> >> Alexey. >>> >> >>> >> tghfbt@... 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@... >>> >> > For additional commands, e-mail: users-help@... >>> >> > >>> >> >>> >> --------------------------------------------------------------------- >>> >> To unsubscribe, e-mail: users-unsubscribe@... >>> >> For additional commands, e-mail: users-help@... >>> >> >>> >> >>> >> >>> >> ------------------------------------------------------------------------ >> >> <a> >> </a> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > -- | ? + ? = To question ----------------\ Paul Sandoz x38109 +33-4-76188109 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re:--- Paul Sandoz <Paul.Sandoz@...> wrote:
> Oleksiy Stashok wrote: > > 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") > > If you are using an XML StAX implementation, like > SJSXP (i do not know > what Woodstox does, the JSR spec is of no help!), > and write characters > other than white space characters (or ones that > conform to comment or PI > productions) then it will produce a non-well-formed > XML document and an > conforming XML parser will barf when parsing the > document. Such a case would be non-wellformed doc, and all xml parsers would thrown an error (unless they can be put into some kind of fragment mode). So in that way, sjsxp and woodstox should behave the same. However, I think what Ilia was saying was that whereas with Stax, it is possible that all-whitespace writeCharacters is allowed in prolog/epilog (Woodstox does allow it; but not if it has non-whitespace -- but where that's checked depends on configuration), most/all SAX implementations do NOT allow any character writing within prolog/epilog. This because philosophically no character content can be added. Any white space in there is purely for convenience, and is not to be considered content. Given above, it'd make sense to either not call writeCharacters() at all, or only do that with stax-backed writers (assuming they all allow this, which I think is the case). There was bit of discussion on stax_builders list as to whether stax parsers are to report such white space (as SPACE events), and conclusion was that they should not. This was based on xml specs showing that such white space really is not even "ignorable white space" in same sense as white space within elements is (when content model is not PCDATA or mixed). Does above make sense? -+ Tatu +- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free Forum Powered by Nabble | Forum Help |