This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes JAXB - Is it possible to read element attributes into Map  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB - Is it possible to read element attributes into Map  " Watch "JAXB - Is it possible to read element attributes into Map  " New topic
Author

JAXB - Is it possible to read element attributes into Map

Steve Law
Greenhorn

Joined: Feb 09, 2009
Posts: 1
Hi,

Is the a way to read the attributes of an element into a Map (using JAXB), with the attribute name as a key in the map, and the attribute value as the value in the Map?

So, for the element:

<test attribute1="val1" attribute2="val2" attribute3="val3" />

Would get unmarshalled to the class:

class Test {
Map<String,String> attributes;
}

And the attributes map would contain the attribute name as the key, and the attribute value as the map value.

Thanks.
 
wood burning stoves
 
subject: JAXB - Is it possible to read element attributes into Map
 
Similar Threads
EL question
Search and Replace tag (Not its Value) in an XML file.
Example of Dynamic attribute in Custom Tag
problem in understanding jstl set tag
Problem retaining form field after submission