[XOM-interest] Simple Data Iteration...

Nils_Kilden-Pedersen at Countrywide.Com Nils_Kilden-Pedersen at Countrywide.Com
Wed Dec 17 17:30:58 EST 2003


Document doc = Builder.build(file);
Element root = doc.getRootElement();
Element parameters = root.getFirstChildElement("PARAMETERS");
Elements elementList = parameters.getChildElements("PARAMETER");
for (int i = 0; i < elementList.size(); i++) {
        Element parameter = elementList.get(i);
        String value = parameter.getValue();
        if ( "10".equals(value)) {
                // That's one you want
        }
}

(or something very close)

xom-interest-bounces at lists.ibiblio.org wrote on 12/17/2003 02:16:15 PM:

> I feel very feeble, since from what I have read, this is a very easy 
package
> to use.
> First, I haven't been able to search the archives, all words entered 
return
> no results, so if this is a very basic question that is in the archive I
> apologize, I tried to scan the past subject lines of threads to see if 
it
> had been asked.
> 
> I have a very simple document:
> <PARAMETERS>
> <PARAMETER>
>   <PARAM_NAME>longer param</PARAM_NAME>
>   <PARAM_SIZE>20</PARAM_SIZE>
> </PARAMETER>
> <PARAMETER>
>   <PARAM_NAME>shorter param</PARAM_NAME>
>   <PARAM_SIZE>10</PARAM_SIZE>
> </PARAMETER>
> <PARAMETER>
>   <PARAM_NAME>another shorter param</PARAM_NAME>
>   <PARAM_SIZE>10</PARAM_SIZE>
> </PARAMETER>
> </PARAMETERS>
> 
> I'd like to find all elements with a param_size of 10 in the order they 
are
> found in the doc. Or, all param_name(s) that match "shorter param".
> 
> Just looking for some hints or a direction...
> 
> Thanks, Anthony
> _______________________________________________
> XOM-interest mailing list
> XOM-interest at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
> 



More information about the XOM-interest mailing list