users@jaxb.java.net

Re: mixed="true" getContent()

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 24 Nov 2003 11:46:37 -0800

What if you just define a simple transformation, perhaps an XSLT
stylesheet, which searches the schema and removes mixed="true".

Then as a part of your build process, you could run that before you
process the schema by XJC.

> elements are defined to be ok. I would prefer not to change the schema
> just in case I had to unmarshal a document that did have mixed content.
> I would be happy to simply ignore the text in this case.

I'm pretty sure if you turn off the validation by the RI, it will simply
drop all the unexpected text. If you still prefer to perform the
validation, then you can combine non-validating JAXB with JARV [1].

Alternatively, you could write a simple XMLFilter [2] that strips off
all the text, then use that filter as an input to the JAXB unmarshaller.


[1] http://iso-relax.sourceforge.net/JARV/
[2] http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/XMLFilter.html

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net