Celer Celer - 2 years ago 120
Java Question

XML element with attribute has ":" in JAXB

I have a problem when I am getting the attributes of a xml file. These attributes are written like this:


With @XmlAttribute I get attributes that they are written on a one word. If I leave this annotation
I get null

How can I get attribute's value of "xml:lang"?


Answer Source

xml is clearly a namespace prefix. You can try stating the namespace it with:

@XmlAttribute(name = "lang", 
              namespace = javax.xml.XMLConstants.XML_NS_URI)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download