wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes parse xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parse xml" Watch "parse xml" New topic

parse xml

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303

I have an xml file like:

However, when i do huginChildren.item(0), i get the o/p as

<press_release id="979846" language="en">
<published date="2005-02-10T07:29:02 CET"/>
<headline><![CDATA[Ericsson reports full year profit of SEK 28 billion]]></headline>
<location href="http://cws.huginonline.com/E/1061/PR/200502/979846.xml"/>

How do i extract location href from this?? plz help.

SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
I can do this very easily using XPath, but I cannot seem to parse CDATA with JDOM, having used your XML.
It is sorta covered in the JavaRanch Style Guide.
subject: parse xml
Similar Threads
Can you read this?
update href field dynamically
Xml with XSLT
How to parse xml inpustream?
Connection Factory not found