Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDOM XML parser

 
Alan Blass
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand.

I have tried:



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

Please help . Thanks
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alan Blass wrote:I do not understand.


What is it that you don't understand?
 
Alan Blass
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the right approach, only you've to crystalize the detail.
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!