Dave,

can you please try the following code and let us know whether it makes a
difference ?

Mapping mapping = new Mapping();
mapping.loadMapping( File );
Unmarshaller unmar = new Unmarshaller(MyObject.class);
unmar.setMapping(mapping);
unmar.setIgnoreExtraAttributes(true);
MyObj mo = (MyObject)unmar.unmarshal(new InputSource(new
FileReader(XMLPAYLOAD)));

Regards
Werner

dave wrote:
> 
> Here's the code..
>                           ....
> 
>                 Mapping mapping = new Mapping();
> 
>                 try {
>                         mapping.loadMapping( File );
> 
>                         Unmarshaller unmar = new Unmarshaller(mapping);
> 
>                         unmar.setIgnoreExtraAttributes(true);
>                         MyObj mo = (MyObject)unmar.unmarshal(new
> InputSource(new FileReader(XMLPAYLOAD)));
> 
>                        ......
> 
> 
>   The above code didn't ignore the Extra attribute. Same issue with Extra
>   element with setIgnoreExtraElement..
>  
> 
> -D
> 
> */Ralf Joachim <[EMAIL PROTECTED]>/* wrote:
> 
>     Dave,
> 
>     I guess you are using the static unmarshal method which you shouldn't
>     do. Instead you should construct an Unmarshaller instance and call
>     setIgnoreExtraAttributes/Elements before unmarshalling.
> 
>     If that's not the case I think you should provide us with an example of
>     what you are doing to be able to replay it.
> 
>     Ralf
> 
> 
>     dave schrieb:
>     >
>     > I use castor-1.0M3-xml.jar.
>     > I have an xml mapping file. Am trying to Unmarshal the XML stream
>     which
>     > can contain additional attributes/elements. I would like to ignore
>     these.
>     > Setting setIgnoreExtraAttributes/Elements didn't help.
>     >
>     > I still got the following error for additional attribute in the XML
>     > input stream
>     > to be unmarshalled:
>     > org.xml.sax.SAXException: unable to find FieldDescriptor for 'you' in
>     > ClassDescriptor of test-setting{file: [not available]; line: 5;
>     column: 14}
>     >
>     > I will NOT have this additional attribute "you" in XML mapping file OR
>     > in the Java object to be unmarshalled.
>     > How do I tell the Unmarshaller to ignore such extra attrs/elements?
>     >
>     > -D
>     >
>     >
>     ------------------------------------------------------------------------
>     > Yahoo! Mail
>     > Use Photomail
>     >
>     > to share photos without annoying attachments.
> 
>     -------------------------------------------------
>     If you wish to unsubscribe from this list, please
>     send an empty message to the following address:
> 
>     [EMAIL PROTECTED]
>     -------------------------------------------------
> 
> 
> Yahoo! Mail
> Use Photomail
> <http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.yahoo.com>
> to share photos without annoying attachments.


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to