[Simple-support] Parsing dynamic elements into a map
Brought to you by:
niallg
|
From: Michael D. <Mic...@Si...> - 2011-11-22 21:44:19
|
We have some XML being returned as key-value pairs such that the element name is the key (and the inner text is the value). The keys (elements) are completely configurable, so the element (user, userName, address1, some_configurable_field) can be any text that a user defines. <patron> <user>31</user> <userName>IPA</userName> <address1> 1234 Lake Drive </address> <some_configurable_field> Configurable data </some_configurable_field> </patron> Is there a way to parse these values into a Map, such that: HashMap map = new HashMap(); key => value "user" => 31 "userName" => IPA "address1" => 1234 Lake Drive "some_configurable_field" => Configurable data for any dynamic element => value pair? Thanks any for any insight. Mike |