Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Re: best xml parser to use

From: Tatu Saloranta <cowtowncoder@-----.--->
To: xml dev <xml-dev@-----.---.--->
Date: 9/7/2006 9:21:00 PM
--- petera <peter.anderson@e...> wrote:

> 
> 
> Thanks to all who replied to my e-mail.
> 
> The approach I have decided upon is to try two
> implementations:
> 
> 1. XSLT
> 
> 2. StAX

I would agree with these main choices. While you could
use data binding (xmlbeans, jaxb2), that seems bit
heavy-weight route since you don't care about type
mappings etc, so most of the work would be overhead.
SAX could of course be used, but I don't know of many
benefits over Stax for this use case.

> 
> XSLT is really the simplest but my bosses might not
> like the memory
> requirements so StAX would a good alternative
> 
> The URL provided by Brennan is excellent on StAX:
>
http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP2.html

In addition, if you decide to go Stax route (which may
make sense if you will eventually get bigger files --
1 M is still with about any solution, unless there's
lots of concurrent processing), you may want to check
out stax-utils project

https://stax-utils.dev.java.net/

since 'raw' Stax API is bit of PITA to use for many
tasks. For copying xml, using Event API it is quite
straight-forward.

You could also try out StaxMate that I wrote
(http://woodstox.codehaus.org/StaxMate) which has
support for accessing xml content in streaming way,
but still allowing hierarchic traversal (in forward
direction).
Documentation is bit sparse, best way may be to read
entries at
(http://www.cowtowncoder.com/blog/blog.html). I should
write sample code for this particular use case though,
since it seems to be kind of recurring question
(usually on stax_builders list though), and it should
also be easy to add sub-tree pass-through copy
operation, so that this particular task would be just
couple of lines total.

-+ Tatu +-


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent