users@jaxb.java.net

Any XML in an element?

From: Gary Gregory <ggregory_at_seagullsw.com>
Date: Thu, 8 Apr 2004 01:36:52 -0400

Hello,

I am trying to specify that an element can contain anything with:

    <xs:element name="Request">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Input">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:any namespace="##any"
processContents="skip"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attributeGroup ref="req:requestAttributeGroup"/>
        </xs:complexType>
    </xs:element>

The reason for this is that we have some legacy XML that we need to
integrate in a containing document. That legacy XML can be pretty much
anything and has its own pile of non-Jaxb code to handle it.

I want to use Jaxb for the containing document and then pass on the
string or DOM Node or /whatever/ down to our other code pile.

This Schema snippet allows my example document to be validated in XMLSpy
as well as parsed by the generated Jaxb code but the "contents" are
null:

        RequestSetType requestSet = (RequestSetType) unmarshaller
                .unmarshal(new StringReader(xml), RequestSetType.class);
        RequestType[] req = requestSet.getRequest();
        for (int i = 0; i < req.length; i++) {
            InputType input = req[i].getInput();
            Object any = input.getAny();
            Assert.assertNotNull(any); // blows up
        }

Is it possible to get Jaxb to give me /something/ for the contents of
<Input>?

Thank you,
Gary



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net