Hi Karuna,

You are using one of the static method of the unmarshaller thus the
feature you are trying to use is not available to the Unmarshaller.

Arnaud
> -----Original Message-----
> From: Annavajjala, Karuna [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 09, 2002 5:00 PM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] Re: XML Versioning - bug in UnmarshalHandler
with
> suggestion how to fix
> 
> Hi:
> I was wondering if this fix is included in Castor 0.9.4.1
> I am using this version and here is what I see:
> I generated java objects for an XML schema using SourceGenerator
(without
> changing "StrictElements" value in properties file). There is no
mapping file
> involved.
> The topmost element in the java object hierarchy is CIP (derived form
the XSD
> root element). Unmarshalling an XML uses the following code:
> 
> FileReader reader = new FileReader(new File(_fileName));
> cip = new CIP();
> Unmarshaller um = new Unmarshaller(CIP.class);
> um.setIgnoreExtraElements(true);
> cip = (CIP)um.unmarshal(CIP.class, reader);
> 
> If the XML has extra elements that are not defined in the XSD and
hence do not
> bind to any java objects, unmarshalling generates the following error:
> 
> Marshal Error: unable to find FieldDescriptor for 'AAA' in
ClassDescriptor of
> CIP org.xml.sax.SAXException:
> unable to find FieldDescriptor for 'AAA' in ClassDescriptor of CIP
> at org.exolab.castor.xml.UnmarshalHandler.startElement(Unknown Source)
> 
> What am I missing? Please help. Thanks.
> -------------------
> Karuna Annavajjala
> Software Architect
> Ph: 614-865-6036
> Fax: 614-865-6037
> 
> --- Original Message ---
> This issue was fixed in the CVS yesterday.
> 
> Thanks,
> 
> --Keith
> 
> 
> Gleb Tulukin wrote:
> >
> > Hi,
> >
> > FYI. Recently I faced the same problem (XML versioning). I searched
the mail
> > list archive and found the message below that addresses it. I am not
sure
> > which version the suggested fix was intended for -- I tried it does
not work
> > in castor 0.9.4. This is what I did and it seems to be working.
> >
> > Problem: In Castor 0.9.4 when you use
> > myUnmarshaler.setIgnoreExtraElements(true) and your XML file has
extra
> > elements you get NullPointerException in the endElement() because
> > descriptor is null and thus if(descriptor.isContainer()) throws
NullPointer.
> >
> >    public void endElement(String name) throws
org.xml.sax.SAXException
> >     {
> >         //......
> >         UnmarshalState state = (UnmarshalState) _stateInfo.pop();
> >         XMLFieldDescriptor descriptor = state.fieldDesc;
> >
> . . . . .
> 
> -----------------------------------------------------------
> 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

Reply via email to