Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to read the XML tags(Element) from a XML file using JAXB or other API

843834Aug 26 2005 — edited Nov 6 2007
Hi,
I want to read the XML file with its Tag name(Element) and the value present in this Tag. I can read the values present in the Tag by using the JAXB API, but want to read the Tag Name also.
How can i do this?

Here is one example-
<BgColor>
<BgRed>250</BgRed>
<BgGreen>153</BgGreen>
<BgBlue>53</BgBlue>
</BgColor>

Now i get the values 250,153,53 but i do not know how to read BgRed, BgGreen, BgBlue.
I want to put i HashMap like this-
KEY VALUE
BgRed 250
BgGreen 153
BgBlue 53

How can i do his?
Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2007
Added on Aug 26 2005
2 comments
1,412 views