commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "petra staub" <cal...@hotmail.com>
Subject Digester question (Hashtables...)
Date Thu, 04 Sep 2003 09:23:09 GMT
hi,

i have following little problem:

How can I get following XML structure into some java entities?
my example.xml look about this:

<list name="list1">
  <element name="name1">value1</element>
  <element name="name2">value2</element>
  <element name="name3">value3</element>
</lists>

<list name="list2">
  <element name="name4">value4</element>
  <element name="name5">value5</element>
</lists>

<list name="list3">
  <element name="name6">value6</element>
  <element name="name7">value7</element>
  <element name="name8">value8</element>
</lists>


I would like now to use digester to parse the XML file and
to generate a class where the list definitions are in hashtables,
something like:

MyClass.getList("list2") ---> Hashtable 
{"name4"=>"value4","name5"=>"value5"}

Concretely, my problem is, that i dont no how to preserve the
name of the list ("list1","list2","list3",...) until the end of reading/
parsing the <element> tags. Thus, is can create an hashtable
with all the <element> tags but when I want to call a setter method
for the hashtable (something like 
MyClass.setList(ElementHashtable,"list1")),
I dont have the list name (in the example "list1")...

I tried to push/pop values from the stack, but cant see through  it....just
doesn't work...

I think, this isn't really a problem, just my limited understanding of the
digester...

Can someone give me a hint?

Thank a lot!!!

_________________________________________________________________
MSN Groups & Chat - Freunde finden - leicht gemacht  
http://groups.msn.com/people/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message