Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Simple Data Iteration...

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Nils_Kilden-Pedersen AT Countrywide.Com
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Simple Data Iteration...
  • Date: Wed, 17 Dec 2003 14:30:58 -0800

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
>




Archive powered by MHonArc 2.6.24.

Top of Page