Werner,

Castor is not able to handle mixed content at the moment. There is already an issue about that available that I do not recall the number of at the moment.

Regards
Ralf


Werner Guttmann schrieb:
Hi,

Can you please create a new Jira issue at http://jira.codehaus.org/browse/CASTOR, and attach all relevant (and minimal) files incl. the XML schema, the XML document instance et alias. And if you followed the guidelines available at
http://www.castor.org/how-to-submit-an-xml-bug.html

that would be appreciated.

Regards
Werner

-----Ursprüngliche Nachricht-----
Von: Sunil Ramaiah [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 13. April 2007 01:09
An: [EMAIL PROTECTED]
Betreff: [castor-user] Marshalling/Unmarshalling error

Here is a small part of the schema I have -


<xs:complexType name="MixedContentType" mixed="true">
 <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Hyper" type="HyperTextType" />
        <xs:element name="Style" type="StyleClassType" />
 <xs:element name="Paragraph" type="ParagraphType" />
               <xs:element name="Choose" type="ChooseType" />
               <xs:element name="If" type="WhenType" />
               <xs:element name="Value-Of" type="ValueOfType" />
 </xs:choice>
</xs:complexType>


and

<xs:element name="StyledText" type="MixedContentType" minOccurs="0" />

<xs:complexType name="StyleClassType" mixed="true">
 <xs:complexContent>
        <xs:extension base="MixedContentType">
                <xs:attribute name="class" type="xs:string" />
               </xs:extension>
 </xs:complexContent>
</xs:complexType>


So a <StyledText> element can look like this -


<StyledText>Hello how are you ? <Style class="bold">I am fine.
</Style> Are you ? <Style class="italic"> I am ok </Style> Ok.
</StyledText>


The generated class MixedContentType looks like this -



public class MixedContentType implements java.io.Serializable {


     //--------------------------/

    //- Class/Member Variables -/

   //--------------------------/



   /**

    * internal content storage

    */

   private java.lang.String _content = "";



   /**

    * Field _items

    */

   private java.util.ArrayList _items;





     //----------------/

    //- Constructors -/

   //----------------/



   public MixedContentType()

    {

       super();

       setContent("");

       _items = new ArrayList();

   } //-- com.intuit.tools.cate.generated.view.MixedContentType()

}



When unmarshalling castor complains about the text in red   "Are you
?"    It puts the first string   "Hello how are you ?" in the _content
 and then

unmarshalls Style and when it encounters   "Are You ?" says this is an
invalid Text node and cannot be added as a MixedContentType.


Looks like Castor does not support this kind of schema or I am I doing
something wrong ? Should I write a custom field handler for this ? Any
hints on how to

go about this issue ?


Thanks in advance for any help.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

--

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to