You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Ke...@bredex.com on 2002/05/14 18:09:15 UTC

RE: XML serializing [TraxUtility Code] ...FYI - JAXP/Xalan/Xerces issue

I have discovered and reported issues with Xalan/JAXP (though I believe it
is more of a spec mismatch issue).  The code I attached earlier attempts to
circumvent this issue when possible by using StreamSource instead of
DOMSource.  I hope this helps...


DOMResult and StreamResult differ on adding DOCTYPE:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7249


Kevin Ross
www.bredex.com




                                                                                                                                              
                    Kevin.Ross@bre                                                                                                            
                    dex.com              To:     xindice-dev@xml.apache.org                                                                   
                                         cc:                                                                                                  
                    05/14/2002           Subject:     RE: XML serializing [TraxUtility Code]                                                  
                    10:55 AM                                                                                                                  
                    Please respond                                                                                                            
                    to xindice-dev                                                                                                            
                                                                                                                                              
                                                                                                                                              





Here is a piece of code I make tremendous use of.  It has worked quite well
for me, and if nothing else should be a good example to get you started...

(See attached file: TraxUtility.java)(See attached file:
TraxUtilityTest.java)


(See attached file: TransformationException.java)(See attached file:
NestedException.java)


I believe the TransformationException is the only legacy class in the
codebase, which you can do with as you please should you choose to reuse
this code.


Kevin Ross





                    "James Bates"

                    <james.bates@amp       To:
<xi...@xml.apache.org>

                    lexor.com>             cc:

                                           Subject:     RE: XML serializing

                    05/14/2002 04:35

                    AM

                    Please respond

                    to xindice-dev







Ahh.. I thought someone might suggest that. I know Cocoon does things that
way.

There's a problem: Xalan doesn't do what it should with namespaces and this
way of
serializing fails in namespace-intensive documents because of that. The
Xerces serializer
seems to work better (Although if it's the same one, how can this be?)

So I'm rather reluctant to use that trick...
James

> -----Original Message-----
> From: Andrius Sabanas [mailto:andsh@node.lt]
> Sent: 14 May 2002 11:01
> To: xindice-dev@xml.apache.org
> Subject: Re: XML serializing
>
>
> James Bates wrote:
> > I couldn't find any serialization in JAXP... Where is it?
> (That would obviously be better; I agree)
>
>
> Hi,
>
> Serialization in JAXP is done in some strange way - you need to
> transform your Source into StreamResult using null transformer,
> transformerFactory.newTransformer().transform(source, stream)
>
> HTH,
>
>
> Andrius
>
>
>


(See attached file: TraxUtility.java)(See attached file:
TraxUtilityTest.java)(See attached file: TransformationException.java)(See
attached file: NestedException.java)