Arnaud
not true I can use direct field access to introspection. Because if I
make Client implements Serializable and remove the public static final
variable the marshalling works. Unfortunately, the client class is
generated from another system and I can not change it.
mike
Arnaud Blandin wrote:
>
> Hi Michael,
>
> Castor can't introspect your class Client, you should provide setter/getter
> methods:
>
> public void setName(String name)
> public String getName()
> public void setGender(String name)
> public String getGender()
>
> Arnaud
>
> > -----Original Message-----
> > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 03, 2001 12:26 PM
> > To: [EMAIL PROTECTED]
> > Subject: [castor-dev] Can't Unmarshal problem
> >
> >
> > Hi all
> >
> > I am trying to unmarhall this xml to the following class. It does not
> > work because it is not implementing Serializable and I am also getting
> > an exception. Client is an existing class and I can change it what's the
> > best to work around this.
> >
> > Thanks in advance for any help
> >
> > mike
> >
> > code:
> > Client c = (Client)Unmarshaller.unmarshal(Client.class, sr);
> >
> > xml:
> > <?xml version="1.0"?>
> > <client><name>Michael</name><gender>F</gender></client>
> >
> > class:
> > public final class Client {
> >
> > public static final String _id_ = "IDL:client/Client:1.0";
> >
> > public Client() { }
> >
> > public String name;
> > public String gender;
> >
> > public Client(String _name, String _gender) {
> > name = _name;
> > gender = _gender;
> > }
> > };
> >
> > exception:
> > org.xml.sax.SAXException: unable to create XMLClassDescriptor for class:
> > client.Client
> >
> > org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java,
> > Compiled Code)
> > org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java,
> > Compiled Code)
> >
> > org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLV
> > alidator.java,
> > Compiled Code)
> >
> > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispa
> > tch(XMLDocumentScanner.java,
> > Compiled Code)
> >
> > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentSc
> > anner.java,
> > Compiled Code)
> > org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
> > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
> > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270)
> > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:391)
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
> >
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev