Hi,
I have a problem. I have got the following XML document:
<foo name="something">
<content>abc</content>
<a><b>as</b></a>
</foo>
And I want to unmarshall it to this class:
@XmlRootElement
public class Foo
@XmlAttribute(name = "name")
String name;
@XmlElement(name = "b")
String b;
}
This is done by following code:
JAXBContext context = JAXBContext.newInstance(Foo.class);
Unmarshaller un = context.createUnmarshaller();
Foo foo = (Foo) un.unmarshal(new File("./data/foo.xml"));
System.out.println(foo.name);
System.out.println(foo.b);
When this code runs foo.name is set to "something", but b isn't set to "as"?
What do I have to do to make this example running?
King regards
Christian