[jdom-interest] reading name-value pairs

Jon Baer jonbaer at digitalanywhere.com
Mon May 14 08:36:07 PDT 2001


Well technically you can't have 2 roots (<sqlquery>) so you need to have 
something over it like:

<query>
   <sqlquery>
   </sqlquery>
   <sqlquery>
   </sqlquery>
</query>

 From this you could do something as such:

Document doc = builder.build(file);
List queries = doc.getRootElement().getChildren("sqlquery");

- Jon

Michael Kastner wrote:

> 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/youraddr@yourhost.com
> 
> 




More information about the jdom-interest mailing list