Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Iterating through XML

Edd Dawson

2004-07-06

Replies:

Hi

I have got the following code :

Document doc = null;
try {
 doc = builder.build(reader);
} catch(Exception ex) {
 return "Error on making xml returned SAXable" + ex.getMessage();
   }



Which puts my inputStream XML nicely into the parser.


Now i have the following in there :

<Response>
 <InboundMessage>
   <Ticket>1278</Ticket>
   <MessageText>Example 1</MessageText>
   <Phone>+4409878656787</Phone>
   <Date>123456123</Date>
 </InboundMessage>
 <InboundMessage>
   <Ticket>1279</Ticket>
   <MessageText>Example 2</MessageText>
   <Phone>+4409878656787</Phone>
   <Date>123456123</Date>
 </InboundMessage>
 <InboundMessage>
   <Ticket>1280</Ticket>
   <MessageText>Example 3</MessageText>
   <Phone>+4409878656787</Phone>
   <Date>123456123</Date>
 </InboundMessage>
</Request>



I can't figure out from the manuals and docs that i have read how to
iterate through all the instances of <InboundMessage> so i can retrieve
the elements of each and bung them in a database.

Would anyone have any ideas how to do so?

thanks
Edd

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.