users@jaxb.java.net

How do I get the CDATA data ?

From: J. Medina <jmedina_at_ON.COM>
Date: Tue, 01 Apr 2003 07:03:20 -0700

I need to process documents -read and generate- that include CDATA. How do I get and set this data using the classes generated by JAXB ? Do I need to include any special bindings ?

Using the schema definitions below, I get a method :

     java.util.List getContent();

for the interface ScriptType. What does it return ? a list of what ?

Also, there is nothing like setContent().

Any help is appreciated.


<xsd:complexType name="ScriptsType">
  <xsd:sequence>
        <xsd:element name="script"
                     minOccurs="0" maxOccurs="unbounded"
                     type="ScriptType"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ScriptType">
 <xsd:complexContent mixed="true">
  <xsd:restriction base="xsd:anyType">
   <xsd:attribute name="name" type="xsd:string"/>
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>

Here is a small sample:

    <script name="install">
    <![CDATA[
        REM Seems that using a CDATA section would be safer in case
        REM some lines contain xml-like lines
        REM <like> <this> <line>
        command < somecommand > othercommand
    ]]>
    </script>