[jdom-interest] reading name-value pairs
philip.nelson at omniresources.com
philip.nelson at omniresources.com
Mon May 14 08:32:17 PDT 2001
A document can only have one root element so I have to assume that the xml
you sent won't parse. Assuming that sqlquery is under a different root
element:
List queries = rootElement.getChildren("sqlquery");
Use the normal List methods like iterator() to help you loop through the
queries and do what you need to do. You might want to make it a little
easier on yourself and make the name an attribute instead of a child
element.
> -----Original Message-----
> From: Michael Kastner [mailto:kastner at galt.de]
> Sent: Monday, May 14, 2001 9:41 AM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] reading name-value pairs
>
>
> Hello,
>
> I am using JDOM for reading and traversing configuration files for web
> applications. At the moment I am stuck with a kind of silly
> problem, but I
> haven't found a solution so far.
>
> Suppose I have this code:
>
> <sqlquery>
> <name>
> QueryHouses
> </name>
> <query>
> SELECT * FROM houses
> </query>
> <sqlquery>
> <sqlquery>
> <name>
> QueryTenants
> </name>
> <query>
> SELECT * FROM tenants
> </query>
> <sqlquery>
>
> How can I access the second query by its name? Or, to make it
> clear: how can
> I tell JDOM that all tags within <sqlquery> (i.e.
> "QueryTenants" and "SELECT
> * FROM tenants") belong together?
>
> Maybe someone can help?
>
> Michael Kastner
> galt.de
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com
More information about the jdom-interest
mailing list