Skip to main content

Accessing element and attribute value with jaxb

1 reply [Last post]
asmrussel
Offline
Joined: 2010-07-12
Points: 0

Hi All,
I parse my xml to xsd.
I can access the type attribute value.how can i access the value of language element.
I want to access the attribute value as well as element value
==============================================
<?xml version="1.0" encoding="UTF-8" ?>

Afar
Abkhazian
Achinese
Acoli
Adangme
Adyghe

=======================================================
<?xml version="1.0" encoding="utf-16"?>


===================================
Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmazza
Offline
Joined: 2005-01-14
Points: 0

Seems a strange question, if you're using JAXB, after you unmarshall[1] you'll have a Java object with the attributes and elements defined--just look for the right getter method.

Do you mean JAX*P*? How are you accessing the type attribute value? That might give us an idea how to get the language element by letting us know what accessing technology you're using. I don't know how you're accessing the XML document--via XSLT, DOM, SAX, StAX -- you'll get four different answers depending on what you're using.

Glen

[1] https://jaxb.dev.java.net/tutorial/section_3_1-Unmarshalling-and-Using-t...