Hi,
I have a Schema that validates the following XML instance (simplified to an
example case):
<?xml version="1.0" encoding="UTF-8"?>
<root>
<parent name="parent1">
<child name="childA"/>
<child name="childB"/>
</parent>
<parent name="parent2">
<child name="childC"/>
</parent>
</root>
I want to use generated JAXB classes from the schema in my application. For
reasons that I won't go into, in controller code I sometimes have only a
reference to a Child, but need to be able to identify the Parent object for
a particular Child instance.
My question: is there currently any way to produce generated classes that
make Child->Parent element navigation possible under JAXB? If not, could
this be considered for future releases of the JAXB specification? It seems
natural to me to have an option for generating getParent() (preferably
type-specific) methods (and thereby requiring the generated Child classes to
store a reference to their Parent object). I have seen example code that
recursively (from the root node) builds a Map of Child->Parent to get around
this.
I have experienced the same problem in a project using Castor-XML, where I
needed to modify the code generator to generate getParent() methods.
Thanks
Brett Randall
_________________________________________________________________
We've 100s of NEW questions! Play Millionaire online to win $$$$. Click here
http://sites.ninemsn.com.au/minisite/millionaire/default.asp
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net