ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » XML Parsers

Post new topic  Reply to topic
 XML Parsers « View previous topic :: View next topic » 
Author Message
elvis_gn
PostPosted: Sun Aug 29, 2010 2:15 am    Post subject: XML Parsers Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi all,

I've a generic requirement, not related to WebSphere as such.

I'm looking for a Java XML Parser which can do reading (large msgs), writing, schema validation, XPath on xmls. And I need it to work elegantly with eclipse apis.

I've tried DOM, SAX, JBeans, JDOM amongst others but they all seem to have some or the other limitation. I'm currently trying xerces2 and reading about woodstox4...

Since we have product development guys here on the forum, I wanted to know which are the favorite xml parsers and ones which can work well for large implementations.

Regards.
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Sun Aug 29, 2010 7:31 am    Post subject: Re: XML Parsers Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

elvis_gn wrote:
I'm looking for a Java XML Parser which can do reading (large msgs), writing, schema validation, XPath on xmls. And I need it to work elegantly with eclipse apis.

I generally use JDOM and it works very well (i.e. Open source projects: MQ File Mover and MQ Channel Monitor).
I don't use JDOM for writing or XPath stuff but for reading and validation it works very well and it plays nice with Eclipse.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
elvis_gn
PostPosted: Sun Aug 29, 2010 10:14 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi Roger,

I tried JDOM and I did like it, but since its built over DOM I'm concerned about the memory footprint...

Have you tried groovy ?

Regards.
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Mon Aug 30, 2010 5:57 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,
elvis_gn wrote:
I'm concerned about the memory footprint...

I've never noticed anything excessive.

elvis_gn wrote:
Have you tried groovy ?

No.

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
JLRowe
PostPosted: Wed Sep 01, 2010 6:58 am    Post subject: Re: XML Parsers Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

What specifically are you looking for?

There is only one definitive XML parser for java and that is apache xerces, this is built into the JDK. Xerces provides a DOM, stax and SAX parser.

DOM is the easiest API to work with, but is memory intensive. SAX or Stax are the most performant way to parse XML but require more code. DOM is built on top of SAX.

JDOM and DOM4J are both more friendly DOM style API's built on top of DOM. The problem with DOM is that it is designed to cross language and does everything through interfaces and factory classes. JDOM and DOM4J use concrete classes with constructors and are therefore easier to code with.

XMLBeans, Castor and JAXB are binding API's that bind java beans to XML documents. JAXB is built into the JDK.

Personally, I use JAXB whenever I can. It is built into the JDK and makes XML handling a lot easier. Some third party code requires me to work with DOM, and I will try and use DOM4J as this interoperates with DOM.
Back to top
View user's profile Send private message Send e-mail
elvis_gn
PostPosted: Wed Sep 01, 2010 10:18 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi JLRowe,

Thanks for detailed response.

JLRowe wrote:
What specifically are you looking for?
I'm looking to work with xml files, few of which are config files within the plugin (and I'll have the xsd for them), but most of them will be user provided and may or may not have an associated xsd.

I tried XMLBeans and found that it created too many classes for my xsd and it needed customization to work with the eclipse IFile, IProgressMonitor etc apis (which ofcourse I need to tweak in each case, but here I could be doing it in multiple places)...I guess Castor and JAXB will go down the same lane.

JDOM is looking good and I'm able to read xmls using XPath. The issue I'm facing is writing with XPath, api not supported very well.

DOM4J I've not tried, but that's coz I don't want to use any memory intensive parser in the tool.

Maybe I will try the JAXB atleast for the config files.

Regards.
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Thu Sep 02, 2010 5:51 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

JDOM, DOM4J, XMLBeans and JAXB all run on top of a DOM, so you are not going to save memory by using them instead of DOM!

Why the concern with saving memory? To save memory you will have to write code that uses SAX or Stax, this a pain in the arse and will make your code more complicated and error prone.

PS. If you are writing eclipse plugins, then you may wish to have a look at EMF. This is capable of reading/writing XML that conforms to a schema, so it is no use for arbitrary XML without a schema.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » XML Parsers
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.