[jdom-interest] JDOM Help (Sorry about the first e-mail HTML)

Chris Buckley cbuckley at cutthroatcom.com
Thu Dec 19 13:04:02 PST 2002


Hi,  I am using JDOM for a project I am working on and I have come across a problem I am using a product called RRDTool to "xport" XML data to me the problem I am having is that the data looks like the following.

<xport>
    <data>
        <row><t>some time</t><v>Input value</v><v>Output value</v></row>
        ......
    </data>
</xport>

I have no problems if there is only 1 "v" tag but if there is 2 I can't access the text.  I need to evaluate each "row" the code I use for one "v" is below but how do I access the second "v" //v1.getChild( "v" ).getChildText( "v" ) doesn't work.  Any thoughts?  I need to test each "v" (can I use xpath below // v1.getChildText( "t/v/v" ) ??

    Document rrd = new SAXBuilder().build(input);
    List rate = rrd.getRootElement().getChild( "data" ).getChildren( "row" );
    Iterator itr1 = ( rate ).iterator();

    while( itr1.hasNext() ) {
     Element v1 = ( Element )itr1.next();
     System.out.println(v1.getChildText( "v" ));
}


thank you very much,

Chris Buckley



More information about the jdom-interest mailing list