Java – JAXB / xjc parent-child navigation
•
Java
I want to have two-way navigation methods in the class between the child object and the parent object
<complexType name="A"> <xs:sequence> <element name="b" type="B" minOccurs="0" maxOccurs="unbounded"></element> </xs:sequence> <attribute name="id" type="ID"></attribute> </complexType> <complexType name="B"> <attribute name="id" type="ID"></attribute> </complexType>
I want the class to look like this:
class A { ... public List<B> getB() { ...} ... } class B { ... public A getA() { ... }
My XML must be as follows:
<a id="a1"> <b id="b1"/> <b id="b2"/> ... </a>
After dissolution, I want to be able to navigate from a to BS and from B to a (through b.geta())! This is a very basic function, but I haven't found a simple way to implement it
Any ideas??
Thank you in advance
Solution
After ungrouping, you can set the object tree as needed after calling, then call... (), and then call the object tree
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码