I have answered my own question here.  I was able to use the org.exolab.castor.types.AnyNode class to MARSHAL mixed content.  I'm not sure if UNMARSHALLING would work with AnyNode, but marshalling works just great.

--
Jason

Jason R. Mihalick wrote:
I am trying to marshall mixed content such as the following:

<MY_TEXT>Text fragment <VAR Name="var1" Type="int">10</VAR> another text
fragment <VAR Name="var2" Type="boolean">true</VAR></MY_TEXT>


I am mapping MY_TEXT as follows:

    <class name="com.abc.xyz.Text">
        <map-to xml="MY_TEXT"/>
        <field name="text"
                     type="string">
            <bind-xml node="text"/>
        </field>
    </class>


Marshalling mixed content in the example above always results in escaping:

    <MY_TEXT>Text fragment &lt;VAR Name="var1"
type="int"&gt;10&lt;/VAR&gt; another text fragment &lt;VAR Name="var2"
type="boolean"&gt;true&lt;/VAR&gt;</MY_TEXT>

Is it possible to prevent Castor from escaping the XML in the mixed content?


I've attached the XSD def for MY_TEXT as a reference.

Thanks in advance,
Jason

<xs:element name="MY_TEXT" minOccurs="0" maxOccurs="1"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="VAR" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="Name" type="xs:string" use="required" /> <xs:attribute name="Type" type="xs:string" use="optional" default="String"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element>



  

------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

Reply via email to