<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>Hi,</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>I have the following xml 
file...</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>***************************************************</FONT></DIV>
<DIV><FONT face="Courier New" size=2>&lt;?xml version="1.0"?&gt;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>&lt;computer&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;type&gt;Personal&nbsp;Computer&lt;/type&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;Dell&lt;/subtype&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;Acer&lt;/subtype&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;Samsung&lt;/subtype&gt;</FONT></DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp; 
&lt;type&gt;MiniComputer&lt;/type&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;MC1&lt;/subtype&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;MC2&lt;/subtype&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;subtype&gt;MC3&lt;/subtype&gt;</FONT></DIV>
<DIV><FONT face="Courier New" size=2>&lt;/computer&gt;</FONT></DIV>
<DIV><FONT face="Courier New" 
size=2>***************************************************</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>I use the following code...to parse the 
data out</FONT></DIV>
<DIV><FONT face="Courier New" size=2>from this xml but not really getting the 
correct</FONT></DIV>
<DIV><FONT face="Courier New" size=2>result.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>***************************************************</FONT></DIV>
<DIV><FONT face="Courier New" size=2>// Build the JDOM Document<BR>Document 
JDOMDoc = saxbuilder.build(new File(filename));</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>// Get the root element<BR>Element root = 
JDOMDoc.getRootElement();</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>/* Print computer type 
information*/<BR>List types = root.getChildren("type");<BR>out.println("Types of 
computer has " + types.size() + ".");<BR>Iterator i = types.iterator();<BR>while 
(i.hasNext()) {<BR>&nbsp;&nbsp; Element type = (Element) 
i.next();<BR>&nbsp;&nbsp;&nbsp;out.println( "&nbsp;&nbsp; * &lt;" + 
type.getText() + "&gt;" );<BR></FONT><FONT face="Courier New" 
size=2></FONT></DIV>
<DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;/* Print computer subtype 
information*/<BR>&nbsp;&nbsp;&nbsp;List subtypes = 
type.getChildren("subtype");<BR>&nbsp;&nbsp;&nbsp;out.println("\t--Subtypes of 
this " + type.getText() +</FONT></DIV>
<DIV><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
" has " + subtypes.size() + ".");<BR>&nbsp;&nbsp;&nbsp;Iterator j = 
subtypes.iterator();<BR>&nbsp;&nbsp;&nbsp;while ( j.hasNext() ) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element subtype = (Element) 
j.next();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.println( "\t\t" + 
subtype.getText() );<BR>&nbsp;&nbsp;&nbsp;}<BR>}</FONT></DIV>
<DIV><FONT face="Courier New" 
size=2>***************************************************</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>I got no problem to get "&lt;type&gt;" 
element but </FONT></DIV>
<DIV><FONT face="Courier New" size=2>could not get "&lt;subtype&gt;" 
data.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>subtypes.size() return 0 to 
me!</FONT></DIV>
<DIV><FONT face="Courier New" size=2>I don't know why?</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>Anyone can guide me on this matter? 
Thanks!!!</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>Kian On, Yong</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV></BODY></HTML>