This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes JDOM XML parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JDOM XML parser" Watch "JDOM XML parser" New topic
Author

JDOM XML parser

Alan Blass
Ranch Hand

Joined: Mar 21, 2010
Posts: 146
Hi! I need to get the ccsid from this XML:



I have:



But I have null pointer exception at line 9.

Please help. thanks.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19751
    
  10

Well, the root element doesn't have a child which is a <ccsid> element, and therefore calling a method which asks for such an element returns null.

Doesn't JDOM have a method which returns descendant elements (not children) with a given name?
Alan Blass
Ranch Hand

Joined: Mar 21, 2010
Posts: 146
I do not understand.

I have tried:



but there is an error. It says incompatible types: Iterable, IteratorIterable.

Please help . Thanks
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19751
    
  10

Alan Blass wrote:I do not understand.


What is it that you don't understand?
Alan Blass
Ranch Hand

Joined: Mar 21, 2010
Posts: 146
The root element, xml-fragment, has a child tag, vp:vpccsidgeneration, which has a child tag, ccsid.

Isn't that correct?

Please help. Thanks
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 608
    
    3
That is the right approach, only you've to crystalize the detail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDOM XML parser
 
jQuery in Action, 3rd edition