Hi Nazir,
If I understand you right, you have something like:
<foo>
<bar>abc</bar>
<foobar>xyz</foobar>
</foo>
but a schema like:
<xsd:element name="foo">
<xsd:sequence>
<xsd:element name="bar" type="xsd:string" />
</xsd:sequence>
</xsd:element>
which in turn causes xjc to generate:
class Foo
{
String bar;
}
and you want to do something like:
JAXBContext ctx = ...
Unmarshaller u = ctx.createUnmarshaller();
Foo foo = (Foo) u.unmarshall(...);
Marshaller m = ctx.createMarshaller()
m.marshall(foo, System.out);
and hope to get the same output that you put in.
The problem here is that JAXB has nowhere to put the extra element.
If you want to support extra elements you should consider putting
xsd:any in your schema to support it.
hth,
dim
On 8/3/06, Muhamad Nazir Samsudin <nazed_at_hotmail.com> wrote:
> Hi,
>
> I have a problem where some of the elements somehow were stripped off to
> accomodate what the schema said. Somehow, when we unmarshall (without
> putting a schema or without schema validation), the JAXB just stripped off
> the unwanted elements based on the schema. May I know whether we still can
> keep the elements (to be checked against another schema) which are beneath
> of the root element? If yes, how can we do it? If No, what are the tasks
> that I need to do to make this work.
>
> Thanks
> ~nazir~
>
> _________________________________________________________________
> Get your mobile ringtones, operator logos and picture messages from MSN
> Mobile http://msn.smsfactory.no/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>