Version 6

    Using XOP-enabled marshalling/unmarshalling


    XOP marshalling/unmarshalling is under development and not yet complete


    Current requirements for XSD types


    • XSD types can be complex or simple types

    • XSD types can optionally declare attributes only from the '' namespace

    • if an XSD type declares xmlmime:contentType attribute, the attribute should be optional since marshalling does not yet support this attribute

    • the type of the text content must be or be derived from xs:base64Binary


    The following types can be used to apply XOP to:

    <xs:complexType name="MyBinaryType">
      <xs:extension base="xs:base64Binary" >
        <xs:attribute ref="xmime:contentType" use="optional"></xs:attribute>



    Default MIME contentType


    This is the current default mapping.


    Java type










    other types



    How to apply XOP processing for a specific XSD component?


    Assuming the requirements specified above for the XSD types are satisfied, to enable XOP processing, one should:

    • implement org.jboss.xb.binding.sunday.xop.XOPMarshaller and org.jboss.xb.binding.sunday.xop.XOPUnmarshaller interfaces. These interfaces are actually copies of javax.xml.bind.AttachmentMarshaller and javax.xml.bind.AttachmentUnmarshaller respectively that were introduced due to build system issues.

    • instances of the XOP marshaller and unmarshaller implementations can then be set on an instance of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding to set the default XOP marshaller/unmarshaller for every XOP-optimizable XSD type in the schema

    • alternatively, instances of the XOP marshaller and unmarshaller can be set on specific org.jboss.xb.binding.sunday.TypeBinding. Setting XOP marshaller/unmarshaller on a TypeBinding overrides SchemaBinding-default XOP marshaller/unmarshaller if the default is set.


    For examples, see org.jboss.test.xml.XOPUnitTestCase in the JBoss testsuite.