users@jaxb.java.net

possible to get wildcard content not registered w/JAXBContext?

From: Geis, Matt <Matt.Geis_at_schwab.com>
Date: Fri, 18 Jul 2003 09:55:08 -0700

Hi,

I'm wondering if anyone might have a solution to the problem I'm
encountering. I have an XSD that I've used to generate classes, and it
specifies that one of the elements can contain an arbitrary number of any
element.



It's in the schema as follows...



<sequence>

        <any processContents="skip" minOccurs="1" maxOccurs="unbounded"/>

      </sequence>



At compile time, JAXB is treating the processContents attribute as "lax".



The problem is that I can't get the contents. It generates a "getAny()"
method, which returns null. Is there a way I can have it return the
contents as a string? I don't' want to define the actual type as String
(I'd prefer to avoid having an huge CDATA block in my instance documents).
I also don't want to generate JAXB classes for a whole different namespace
(the "namespace" attribute of the "any" element is therefore missing).



I'm guessing that I'm missing something in my understanding of XML Schema
and/or JAXB. The spec says that JAXB doesn't have to handle this kind of
content, but it seems that I should at least be able to see what's in the
doc.



Am I defining the schema correctly?



The actual use of this is that I will include a WSDL document here as a
sub-element of an element in my own schema. I know, it's not
architecturally pure, but that's how we're approaching it (this is for a
simple migration tool, and we want to keep the effort and footprint small).



I'm using JAXB 1.0. I noticed that 1.0.1 allows you to map a wildcard to a
DOM. However, if JAXB is currently returning a null list, I wouldn't be
surprised if it just returned a null DOM.



Is there any way I can get the information I'm looking for?



Thanks in advance,

Matt