Hi Erik,
Thanks for your reply. Yes with class descriptors its working fine. The
reason for not using class descriptors is I don't have access to class
descriptors.
My client program is giving me a JavaBean (not created by source generator -
I mean not like the file attached to original message - but follows JavaBean
specifications-public getter/setter) and document object (both are derived
from the same schema) and I use unmarshall.unmarshall method to populate the
given JavaBean from the given document object and do some additional work to
the JavaBean and gives it back to client. So I don't have access to class
descriptors, I thought default introspection does serve the purpose.
I tried with mapping... Unfortunately this code snippet didn't work...
UsernameToken uToken=new UsernameToken();
Unmarshaller uMarsh= new Unmarshaller(mapping);
//uMarsh.setIgnoreExtraAttributes(true);
uToken= (UsernameToken)
uMarsh.unmarshal(uToken.getClass(),
doc);
But this worked :)
Unmarshaller unmar = new Unmarshaller(mapping);
UsernameToken uToken = (UsernameToken)unmar.unmarshal(doc);
Now I am having problems when I have an xmlns usage in document like this
<?xml version="1.0" encoding="UTF-8"?>
<UsernameToken xmlns:wsse="http://www.w3.org/2001/XMLSchema">
<wsse:Username type="user">Ranjith</wsse:Username>
</UsernameToken>
and Castor throws this exceptions ..
org.xml.sax.SAXException: unable to find FieldDescriptor for 'Username' in
Class
Descriptor of UsernameToken
at
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.
java:1249)
-------------
-------------
Is it possible to unmarshall without Descriptors when there are namespace
usages in document?
Your reply will be deeply appreciated,
Ranjith Pillai
-----Original Message-----
From: Ostermueller, Erik [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 6:15 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Unmarshall-Name space problem.
Is there are particular reason why your not using the *Descriptor files?
They should fix your problem.
--Erik O.
> -----Original Message-----
> From: PILLAI,RANJITH (HP-PaloAlto,ex1)
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 8:07 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Unmarshall-Name space problem.
>
>
>
>
> Hi castor group,
> Please help.
> I am new to Castor and I am evaluating Castor
> for our project requirements. Unfortunately
> Unmarshaller.unmarshall method is not working as I
> expected. Some body please clarifies this. For your
> convenience I attached three Java files created by
> Castor and they are (Password.java, Username.java and
> UsernameToken.java)
>
> I am using Unmarshaller.unmarshall(Class,Document)
> method. So in my case I am calling
> UsernameToken uToken=new UsernameToken();
> uToken= (UsernameToken)
> Unmarshaller.unmarshal(UsernameToken.class,
> doc);
> where doc is
> <?xml version="1.0" encoding="UTF-8"?>
> <UsernameToken>
> <Username test="hi">Ranjith</Username>
> <Password Type="PasswordText">ranjith</Password>
> </UsernameToken>
>
> Unfortunately after I execute unmarshall method, still
> my uToken is null and Castor is not throwing any
> exceptions also.
>
> Note: I am not using any Descriptor files as well as
> mapping files.
>
> I appreciate any feedback...
> Ranjith Pillai.
>
>
>
>
>
-----------------------------------------------------------
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