• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Which one is the best XML parser?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My application need to read some parameter file in XML format. Can some one suggest me a very fast and small footprint parser?
Thanks
Anthony
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just starting to learn XML. I am also interested in what would be a good parser to start off with.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I started with Crimson parser which is the parser from Sun. It is a packaged with the JAXP (Java Api for Xml Parsing) download from sun. It is free and fast. XP is another good parser that I've used. If you're starting with Xml using Java, then I would recommend Crimson.

Originally posted by Stanley Tan:
I'm just starting to learn XML. I am also interested in what would be a good parser to start off with.


 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
Working with "xerces" parser will be great.It is freely available at apache site.It gives great performance.Just go for it!!!

------------------
 
Anthony Kwok
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Sun already launch the 'official' API for XML. Should I make use of it or other third parties XML parser? I heard that there is non-validate one named 'Lighting' which is very fast and small memory consumption. Anyone use this one can share experience with us?
Thanks
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you looking for a DOM or SAX parser..
I was recently recommended JDOM for our project. I dont know details about JDOM but it is supposed to be easier to use then
sun JAXP. I have written a properties file reader using JAXP but sometimes I find JAXP to be cumbersome and an API with higher level constructs is definitely required. And I suppose JDOM is supposed to do that.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have justed finished a project using JAXP and loved it. I used the DOM parser and it works great have never really had a problem with it. The other end of the project is using Xerces and they found it to be easy to use as well.
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Aelfred is an excellent SAX paser with a small memory footprint and is very fast. It's really good for applets. It's written by the foremost figure in SAX, David Megginson.
-info from Professional Java XML.
You can download it from http://www.opentext.com/services/content_management_services/xml_sgml_solutions.html#aelfred_and_sax
Professional Java XML is awesome! I recommend everyone to get it.
hope this helps,
Yoo-Jin.
 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really like sun's xml parser.. It is easy to use.

Originally posted by Anthony Kwok:
Hi,
My application need to read some parameter file in XML format. Can some one suggest me a very fast and small footprint parser?
Thanks
Anthony


 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try http://www.themindelectric.com , good one there as well.
paul
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Time out!
A lot of you have given many different answers and now I'm spinning! I've heard of Xerces a lot but not of Crimson. Is Crimson the reference implementation of an XML parser by Sun? What do you mean it is packaged with the JAXP? So JAXP isn't an XML parser but a package?
Mohit Joshi: You used a lot of acronyms. Care sharing what they all mean? What is DOM/SAX and their difference?
Last question: Does all this come with JDK1.3 or J2EE1.2.1 ?
Phew!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest the use of IBM VisualAge for Java with IBM Sax Parser. VAJ comes with some basic tutorials about how to start using SAX and create some reader classes.
And yes, SAX is always the best choice for starters on XML. cause its less complex and easy to learn. So whether you use VAJ or not, but start with SAX Parsers(Xerces or IBM) to learn XML. And you might find many good tutorials on net to do that.
refer these as some of the useful links
http://www.xmldir.com/default.asp
http://www.itworld.com/nl/java_tut/01312001/
 
mohit joshi
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a Dom parser keeps the tree structure of xml ( along with the Data) in memory, so modifying the structure / Data is easy and can be done as many times as required.
A SAX parser reads the XML but doesnt keep the structure / Data in memory, instead it passes on the information to listeners which can then either create their own tree for manipulation ( the listener can be a DOM parser for example). Usually SAX parser is used in rare situations where performance is very important.
I am sure you can find a lot of information about this on the net / javaranch itself.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anthony Kwok:
Hi,
My application need to read some parameter file in XML format. Can some one suggest me a very fast and small footprint parser?
Thanks
Anthony



Your first choice has to be whether you want a DOM or SAX parser. Since it sounds like memory is at a premium, we will assume you want to use SAX.
Many a SAX parser is available, but the smaller they get the more lax they become with implementing XML standards and features, such as validation. Here are a few to look at:
- aelfred: http://www.opentext.com/services/content_management_services/xml_sgml_solutions.html#aelfred_and_sax
- MinML: http://www.wilson.co.uk/xml/minml.htm
- kXML: http://kxml.enhydra.org/
These last two were intended primarily for embedded devices (cell phones) as they consume very little memory. Hopefully one of these will fit your needs.
------------------
Jeremy Crosbie
Co-Author of Professional Java XML
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would recommend JDOM, I have been using it for past one year and it is becoming a Java standard.
 
mohit joshi
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Swami,
Since you have been using JDOM for some time, can you give feedback about how it compares with JAXP. I have to decide whether to migrage an entire project from JAXP to JDOM and I should know if it is worth it..
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the clarification between DOM and SAX XML parsers. My first question still stands. What is JAXP? And what is JDOM? Thank you.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAXP == Sun's Java APIs for XML Pasing http://java.sun.com/xml/xml_jaxp.html
JDOM ==

...a complete, Java-based solution for accessing, manipulating, and outputting XML data from Java code...

http://www.jdom.org/

Originally posted by Stanley Tan:
Thank you for the clarification between DOM and SAX XML parsers. My first question still stands. What is JAXP? And what is JDOM? Thank you.



[This message has been edited by Kris Decker (edited August 28, 2001).]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SAX and DOM are programming language neutral specifications by W3C. Xerces (the sax parser of apache) for example is available for both Java and C++. Obviously this is an advantage if you have to work with more than one language.
On the other hand the APIs are restricted in using java specific constructs for the same reason. Here JDom comes into play: It is designed to *not* necessarily conform to the W3C standards but to provide an API that feels much more natural to Java developers; for example it uses the Collections API of Java 2.
I would go with JDom in most cases.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For line-by-line parsing, I would strongest suggest Apache's Xerces.
Here's my thought about choosing XML parsers: Try to go to some big companies (esp. the E-Commerce ones) sites like Commerce-One and see if they have their own XML DTDs as "standard". If so, then they would have probably tested them out with some parsers out in the market. Then you'll see which one is more "familiar" and should start to learn first.
KMWorld
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the replies. There are so many things on xml.apache.org. I should get Xerces and start from there? Would that be advisable for a beginner? Someone said that it was limiting? How limiting is that? (Will it be enough for beginning XML?)
And what is Xalan?
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JDOM is lightweight which need a parser and a tranformer work behind it. You can use either xerces or crimson as its parser, xalan or saxon as its tranformer.
We just switched from jaxp1.0 to jaxp1.1, from xerces to crimson, from xalan from saxon. Adopt JDOM in our new code.
Thanks!
Roseanne
Join our Study Group when certified

[This message has been edited by Roseanne Zhang (edited August 28, 2001).]
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by lightweight (or small footprint?) Does that mean it takes up little memory?
I still don't get it. What is the difference between these:
jaxp1.0 to jaxp1.1, from xerces to crimson, from xalan from saxon
? JAXP is the API (like javax.swing?)
Xerces/Crimson is the XML parser ?
What is Xalan/Saxon
How do they all converge into the big picture? Thanks
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used the JAXP parser. As a beginer, I feel that it is not diffucult to use or get a particular parser. But rather it is more diffcult to find out how to use a particular parser with suitable examples such that they satisfy your needs in the initial stage.
I found it eaisest to begin with the sun's JAXP parser.
Hope standardisation and secifications would cause more ease in programming practices.

------------------
abhijit from pune.
Ability alone is not enough for success,it must be sparked by ambition and sustained with determination
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry. I am beginner too. I thought JAXP was not a parser and that it was a framework so that I could use any parser in my application. Someone please clarify my doubts. Thank you.

Originally posted by Abhijit Kulkarni:
I used the JAXP parser. As a beginer, I feel that it is not diffucult to use or get a particular parser. But rather it is more diffcult to find out how to use a particular parser with suitable examples such that they satisfy your needs in the initial stage.
I found it eaisest to begin with the sun's JAXP parser.
Hope standardisation and secifications would cause more ease in programming practices.


 
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Hope this URL helps.
http://www.xml-zone.com/articles/pm020101/pm020101-1.asp
TIA
------------------
L Goundalkar
[email protected]
Sun Certified Programmer for Java 2 Platform
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the link. The more I read, the more I'm learning about XML. The article refers to JAXP as Sun's XML parser and not an XML framework. So I guess it is a parser after all. It's quite surprising Microsoft's parser is so fast. Is that what .NET uses?
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Xalan and Saxon are both XSL-Processors. See http://www.w3schools.com/xsl/
 
mohit joshi
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do find it strange that microsoft parser is faster then the others by a factor of 10(according to above article). This indicates that the basic process of parsing would be different for microsoft parser. Unfortunately no one can find out because of their propriety code..
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I think I got it. XSL is used to transform XML into HTML and XSL uses XSLT to do the transforming. Correct?
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm reading one of the articles provided in the links and came across a statement that said that XML is a metalanguage - a language used to define new markup languages. What does this mean? I can create my own version of HTML?
 
mohit joshi
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well Stanley, you sure are learning fast..
1) XSL is used to transfrom xml into html. True. But remember that html is also XML ( if it is well formed ). so a more generic description would be XSL is used to transform xml in to another xml( which could be html).
2)XSL uses XSLT to do transformation. If I am correct ( and that is a big question ) XSL can be viewed as combination of XSLT and XPath. The XSLT is for XSL(Transformation). So you can say that XSL engines use XSL to do transformation. XSL and XSLT are sometimes used interchangably so you can say XSLT engines use XSLT to do transformation.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply. I think I'll be dreaming about Xs tonight.
HTML is also XML - is this XHTML or is that another issue all together?

Originally posted by mohit joshi:
Well Stanley, you sure are learning fast..
1) XSL is used to transfrom xml into html. True. But remember that html is also XML ( if it is well formed ). so a more generic description would be XSL is used to transform xml in to another xml( which could be html).
2)XSL uses XSLT to do transformation. If I am correct ( and that is a big question ) XSL can be viewed as combination of XSLT and XPath. The XSLT is for XSL(Transformation). So you can say that XSL engines use XSL to do transformation. XSL and XSLT are sometimes used interchangably so you can say XSLT engines use XSLT to do transformation.


 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the course of reading one of the superly abundant articles and links from Javaranch, I have learned that there are two types of XML parsers - validating and non-validating. What type are the XML parsers described in this thread?
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAXP is API, mostly are definition of a bunch of interfaces. You can use any parse implements those interfaces.
The above mentioned so-called JAXP parser is crimson which shipped with JAXP, but actually is not part of JAXP. You can use other parser instead. Crimson was SUN's reference implementation of JAXP parser, and now Sun donated it to Apache group.
JDOM is a set of API too, but they are concrete classes, which uses any JAXP parser. When you download JDOM, we will get a crimson and/or xerces parser with it. However, they are actually not part of JDOM. JDOM uses them.
I hope I make myself clear a little bit.
Roseanne
 
reply
    Bookmark Topic Watch Topic
  • New Topic