Hi,
I've got a question regarding mapping a XML to objects using JAXB 2.0.
Assume I have following XML-file:
<?xml version="1.0"?>
<products>
<product>
<name>A product</name>
<price>19.99</price>
<addInfo>
<info seq="1" content="Blah blah"/>
<info seq="2" content="More blah blah"/>
</addInfo>
</product>
... more products ...
</products>
Using xjc this would generate a number of classes:
class Products {
List<Product> product;
}
class Product {
String name;
Double price;
AddInfo addInfo;
}
class AddInfo {
List<Info> info;
}
class Info {
Integer seq;
String content;
}
Unfortunately this won't do in my case since I need to reuse an old
class structure which looks like this:
class Products {
List<Product> product;
}
class Product {
String name;
Double price;
List<Info> info;
}
class Info {
Integer seq;
String content;
}
As you can see there is no AddInfo-class, I basically want to "jump"
over the <addinfo>-element. The question is: How do I annotate this? I
don't think @XmlElement(name = "addinfo/info") like an XPath-expression
will do.
Thanks a lot in advance!
Daniel Pfeifer