Hi Tom,

These is quite strange, I can't manage to reproduce your problem. I am
able to unmarshal and then marshal your document with your
mapping.xml with no problem.

If you want I can send you my test case to see if it is working on
your computer or not.

Seb

Tom Drake writes:
 > 
 > I'm having difficulty unmarshalling Vectors of Strings and arrays of
 > Strings. If my classes are defined in mapping.xml, Castor will simply not
 > unmarshall string arrays and string vectors. If I remove the mapping.xml
 > entries, then Castor will marshall and unmarshall just fine, however, the
 > results don't match the DTD's that I am working with (attributes vs.
 > elements) so, I must create the mappin.xml entries to compensate. It seems
 > I'm caught between a rock and a hard place
 > I'm using castor-0.9.3.
 > 
 > ---------------------------------------
 > Here's the exception I get:
 > ---------------------------------------
 > 
 > org.xml.sax.SAXException: Illegal Text data found as child of: name
 >   value: "Russell"
 >  at
 > org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:413)
 >  at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
 >  at
 > org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
 > .java:1480)
 >  at
 > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
 > LDocumentScanner.java:1205)
 >  at
 > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
 > java:381)
 >  at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
 >  at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
 >  at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
 >  at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:391)
 > 
 > ---------------------------------------
 > Here's the xml document
 > ---------------------------------------
 > <Doc Foo="myFoo">
 >     <name>Russell</name>
 >     <name>Lee</name>
 >     <name>Alyse</name>
 > </Doc>
 > ---------------------------------------
 > Here's the java class
 > 
 > public class Doc {
 > 
 >   private String foo;
 >   public Vector Name;
 >   public String [] email;
 >   public void setName(java.util.Vector names) { Name=names; }
 >   public java.util.Vector getName() { return Name; }
 >   public void setEmail(String [] addrs) { email = addrs; }
 >   public String [] getEmail() { return email; }
 >   public Doc() {
 >   }
 >   public void setFoo(String f) { foo = f; }
 >   public String getFoo() { return foo; }
 > }
 > 
 > ---------------------------------------
 > Here's the mapping.xml
 > ---------------------------------------
 > 
 > <class name="Doc">
 >   <map-to xml="Doc"/>
 >     <field name="Foo"><bind-xml name="Foo" node="attribute"/></field>
 >     <field name="name" type="string" collection="vector">
 >       <bind-xml name="name"/>
 >     </field>
 > </class>
 > 
 > 
 > 
 > Regards,
 > 
 > Tom Drake
 > President, software/etc inc.
 > Email: [EMAIL PROTECTED]
 > 
 > ----------------------------------------------------------- 
 > If you wish to unsubscribe from this mailing, send mail to
 > [EMAIL PROTECTED] with a subject of:
 >      unsubscribe castor-dev




-- 
There is a theory which states that if ever anyone discovers exactly
what the Universe is for and why it is here, it will instantly
disappear and be replaced by something even more bizarre and
inexplicable. There is another theory which states that this has
already happened.
       -- Douglas Adams, The Restaurant at the End of the Universe

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

Reply via email to