2

I am trying to use JAXB to extract an attribute 'xml:lang' from the following:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0"    xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-US" xml:base="http://asmarterplanet.com/wp-atom.php">

However, I don't know what the namespace would be for the 'xml' prefix. In the @XmlAttribute annotation for the field, I've tried all of the following:

@XmlAttribute(name = "xml:lang")
@XmlAttribute(name = "lang")
@XmlAttribute(name = "xml:lang", namespace = "http://www.w3.org/2005/Atom")
@XmlAttribute(name = "lang", namespace = "http://www.w3.org/2005/Atom")
@XmlAttribute(name = "lang", namespace = "xml")
@XmlAttribute(name = "xml:lang", namespace = "xml")

Is there some kind of default namespace when using 'xml' as the prefix?

Westy
  • 707
  • 2
  • 10
  • 23

1 Answers1

1

I believe the namespace for the xml prefix is http://www.w3.org/XML/1998/namespace.

Therefore the annotation should be:

@XmlAttribute(name="lang", namespace="http://www.w3.org/XML/1998/namespace")

For More Information

bdoughan
  • 147,609
  • 23
  • 300
  • 400