• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Parsing / Modifying XML Documents using DOM

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys
Can anybody please tell me - How to go about xml parsing using some good parser which has decent api.

basically if I need to parse
<oraganization>
<division>
<div1>d1</div1>
<div2>d2</div2>
<division>
</oraganization>
I should be able to use sth like "oraganizaion/division/div"
Kind of xpath - I was doing it already with msxml 3 but I need to upgrade to non ms platforms. I have seen xalan but could not make much of it.
Thanks a lot!
pach.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a DOM parser on hand? If not download either Xerces from Apache or JAXP from Sun( comes with their Crimson parser). These downloads comes bundled with some excellent example programs that can be used as a starting point.
Good luck!
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For parsing an xml file many methods are there.One of the flexible methods is using <xtags> provided by apache.
It is easiest one to implement all your applications.The concept of xtags is same like xsl,but the difference is in xtags you can embed your xpath and xslt transformations in jsp as well as u can parse an XML,which resides in any server.To my knowledge Parsing is not possible in xsl.
To know more about this just visit http://jakarta.apache.org/taglibs/doc/xtags-doc/intro.html.
From there download xtags library..In that zip file u could find
xtags-examples.war file.Again if u extract this war file then u will find all necessary examples for your application.
best regards,
paramaguru
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!