[jdom-interest] Again: Only getting the first element node

Rick Nucci rick_nucci at boomi.com
Tue Oct 10 14:24:07 PDT 2000


Hello,

The getChildren() method will only return elements that are children of the
element you are calling this method on.  So in this case the root of this
doc, classes, has only one child, term, so you will only have that element
returned.

Regards,

Rick Nucci


-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of David Parker
Sent: Tuesday, October 10, 2000 4:48 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Again: Only getting the first element node


David Parker wrote:
 >
 > Updated to version beta 5 and still seeing only first element
 > Is there a problem with setting the list from the root?
 > The size of the list is 1.
 >
 > > // Get the root element
 > > org.jdom.Element root = jdomDoc.getRootElement();
 > >
 > > List mycourse = root.getChildren(); //return all children
 >
 > java.util.Iterator iter = mycourse .iterator();
 > davDebug += "Size of myCourses list: " + mycourse .size();

Can you post your XML document?
-Brett


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE classes SYSTEM "clesses.dtd">
<classes>
     <term descr="Fall 2000-2001" id="1012">
         <class id="56838">
             <course id="002767">
                 <description>Intro Organic Chemistry</description>
                 <subject id="224">CHEM</subject>
                 <catalognumber>343</catalognumber>
                 <units>3</units>
                 <section>003</section>
                 <component>LEC</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0047 1361">
                 <room>1361</room>
                 <building>CHEM</building>
             </facility>
             <schedule>
                 <starttime>01:20 PM</starttime>
                 <endtime>02:10 PM</endtime>
                 <pattern>MWF</pattern>
             </schedule>
             <exam combined="N" type="FIN">
                 <timecode>10</timecode>
                 <schedule>
                     <startdate>12/19/2000</startdate>
                     <starttime>12:25 PM</starttime>
                     <endtime>02:25 PM</endtime>
                 </schedule>
             </exam>
         </class>
         <class id="58779">
             <course id="015589">
                 <description>General Physics</description>
                 <subject id="754">PHYSICS</subject>
                 <catalognumber>103</catalognumber>
                 <units>4</units>
                 <section>002</section>
                 <component>LEC</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0057 1300">
                 <room>1300</room>
                 <building>STERLING</building>
             </facility>
             <schedule>
                 <starttime>02:25 PM</starttime>
                 <endtime>03:15 PM</endtime>
                 <pattern>MWF</pattern>
             </schedule>
             <exam combined="N" type="FIN">
                 <timecode>72</timecode>
                 <schedule>
                     <startdate>12/17/2000</startdate>
                     <starttime>10:05 AM</starttime>
                     <endtime>12:05 PM</endtime>
                 </schedule>
             </exam>
         </class>
         <class id="58807">
             <course id="015589">
                 <description>General Physics</description>
                 <subject id="754">PHYSICS</subject>
                 <catalognumber>103</catalognumber>
                 <units>0</units>
                 <section>329</section>
                 <component>LAB</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0057 4421">
                 <room>4421</room>
                 <building>STERLING</building>
             </facility>
             <schedule>
                 <starttime>02:25 PM</starttime>
                 <endtime>04:20 PM</endtime>
                 <pattern>R</pattern>
             </schedule>
             <exam/>
         </class>
         <class id="58835">
             <course id="015589">
                 <description>General Physics</description>
                 <subject id="754">PHYSICS</subject>
                 <catalognumber>103</catalognumber>
                 <units>0</units>
                 <section>629</section>
                 <component>DIS</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0057 3401">
                 <room>3401</room>
                 <building>STERLING</building>
             </facility>
             <schedule>
                 <starttime>01:20 PM</starttime>
                 <endtime>02:10 PM</endtime>
                 <pattern>R</pattern>
             </schedule>
             <exam/>
         </class>
         <class id="61174">
             <course id="011599">
                 <description>Trigonometry</description>
                 <subject id="600">MATH</subject>
                 <catalognumber>113</catalognumber>
                 <units>2</units>
                 <section>020</section>
                 <component>LEC</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0056 0224">
                 <room>224</room>
                 <building>INGRAHAM</building>
             </facility>
             <schedule>
                 <starttime>12:05 PM</starttime>
                 <endtime>12:55 PM</endtime>
                 <pattern>TR</pattern>
             </schedule>
             <exam combined="N" type="FIN">
                 <timecode>62</timecode>
                 <schedule>
                     <startdate>12/18/2000</startdate>
                     <starttime>05:05 PM</starttime>
                     <endtime>07:05 PM</endtime>
                 </schedule>
             </exam>
         </class>
         <class id="72992">
             <course id="000843">
                 <description>Indians of North America</description>
                 <subject id="156">ANTHRO</subject>
                 <catalognumber>314</catalognumber>
                 <units>3</units>
                 <section>001</section>
                 <component>LEC</component>
                 <sessioncode>A1</sessioncode>
             </course>
             <facility id="0046 5208">
                 <room>5208</room>
                 <building>SOC SCI</building>
             </facility>
             <schedule>
                 <starttime>08:00 AM</starttime>
                 <endtime>09:15 AM</endtime>
                 <pattern>TR</pattern>
             </schedule>
             <exam/>
         </class>
     </term>
</classes>

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list