XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Re: best xml parser to use

--- petera <peter.anderson@egsgroup.com> 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 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS