Hi,

To parse a String to an AnyNode you just have to set to the parser
as a ContentHandler the SAX2ANY handler (org.exolab.castor.xml.util.SAX2ANY).
BTW if you are generating the descriptors with the SourceGenerator, you
shouldn't need
to use a mapping file.

Hope this helps,

Arnaud

-----Original Message-----
From: David Leon [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] <any> support


Hi,

I'm experiencing some problems with the <any> element and I need some help to
understand what I'm doing wrong:
This is the part of my schema that I use to generate the class Thing:

<element name="Thing">
 <complexType>
  <sequence>
   <element name="code" type="integer" use="required"/>
   <element name="text">
    <complexType>
     <sequence>
      <any namespace="##local" processContents="skip"/>
     </sequence>
    </complexType>
   </element>
  </sequence>
 </complexType>
</element>

The mapping file:

 <class name="myPackage.Thing">
  <map-to xml="THING"/>
   <field name="code" type="integer">
    <bind-xml name="code" node="attribute"/>
   </field>
   <field name="Text" type="myPackage.Text">
    <bind-xml name="TEXT"/>
   </field>
 </class>
 <class name="myPackage.Text">
  <map-to xml="TEXT"/>
   <field name="anyObject">
    <bind-xml name="any"/>
   </field>
 </class>

This is the xml that I want to marshall/unmarshall:

<THING code="123">
 <TEXT>
  <any>Here some <b>HTML</b> text with some <i>tags</i></any>
 </TEXT>
</THING>

The SourceGenerator generates a class Thing and a class Text (with setAntobject
and getAnyObject methods). But I don't know how to use them in combination with
the mapping.xml to get the desired result.
The thing is: I know how to parse a string into a org.w3c.dom.Document object,
but I don't know how to parse a string into an AnyNode object.
Does this make sense? What am I doing wrong?
Thanks in advance,

David Le�n S�nchez
[EMAIL PROTECTED]

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to