I believe this issue (or at least one similar to it) has been brought up in
previous threads (1), but I wanted to confirm something and ask the team how
this will work in the future. Questions are near the bottom.
Kohsuke gave a pretty simple example previously that I *think* is the same
thing, but just to be sure, here's an example that I know behaves strangely.
Schema fragment:
<complexType name="SomeType">
<sequence>
<element name="Something" type="int" />
</sequence>
</complexType>
<element name="SomeElement" type="this:SomeType" />
<element name="Container">
<complexType>
<sequence>
<element name="InnerElement"
type="this:SomeType" />
</sequence>
</complexType>
</element>
Sample code fragment:
SomeType someType = objFact.createSomeElement();
someType.setSomething(5);
Container container = objFact.createContainer();
container.setInnerElement( someType );
marshaller.marshal( ...output... );
Resulting output fragment:
<Container>
<InnerElement>
<SomeElement>
<Something>5</Something>
</SomeElement>
</InnerElement>
</Container>
Questions:
1) Is this how this will behave in the future?
2) Will the inclusion of type substitution change how this looks/behaves?
3) If the ability to "T getType()" and "setType(T)" of an element is
implemented in the future, will this be handled automatically in this case?
4) If this is going to continue to behave this way, shouldn't setting an
Element into another Element field of the same type throw an exception or
something?
Thanks, as always, for your time and hard work.
Brian Franklin
----
Footnotes: (following the trend that Ryan seems to be pushing)
(1) For those of you who want to search the archives, the following topics
seemed to be at least somewhat relevant to the issue:
"Marshalling a content sub-tree"
"Help!! Elements & types"
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net