Skip to main content

Runtime binding of anyType fields based on element name

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
padamide
Offline
Joined: 2009-11-09

I am using the UserAreaType of the hrxml standard. It is defined as:

<xsd:complexType name="UserAreaType"><br />
    <xsd:annotation><br />
        <xsd:documentation>Allows the implementer to extend the base HR-XML specification.<br />
This is done by defining the additional information in XML Schema and referencing the new schema in the xml instance document throught the use of namespaces. Once this is done the additional information defined there can be carried in the BOD XML instance document.<br />
            </xsd:documentation><br />
    </xsd:annotation><br />
    <xsd:sequence><br />
        <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/><br />
    </xsd:sequence><br />
</xsd:complexType><br />
 

I created my own type, UserAccountExtType. I plan I inserting elements of these time into the UserArea section. Is it possible to create a custom jaxb binding that binds elements of a particular QName to a given Java type? I'm trying to prevent having these data show up as a plain old DOM node after being unmarshalled.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
blaise_doughan
Offline
Joined: 2003-09-30

You can use @XmlAnyElement(lax=true). For an example see:

-Blaise