[jdom-interest] Iterating through XML

Edd Dawson E.J.Dawson at derby.ac.uk
Tue Jul 6 04:34:39 PDT 2004


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




More information about the jdom-interest mailing list