Hi! I get an error while unmarshalling an xml element with type=any. It seems to be dependent on the number of child objects of that element. Appended are two examples, case 1 working and case 2 with the error.
As schema I have used a soap schema, which I have stripped down to isolate the error. I am using castor 0.9.5.2 with xerces 1.4.4. Is this error known and are there workaraounds? thanks markus -- xml schema begin -- <?xml version='1.0' encoding='UTF-8' ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" > <xs:element name="Body"> <xs:complexType> <xs:sequence> <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> -- xml schema end -- Generate Body class from the schema: %JAVA% -classpath %CP% org.exolab.castor.builder.SourceGenerator -i %SCHEMA% -package org.anytest -dest src -- program start -- Unmarshaller un = new Unmarshaller( org.anytest.Body.class); org.anytest.Body body = (org.anytest.Body) un.unmarshal(new StringReader(xmlAsStr)); System.out.println(body.getAnyObject(0)) ; ; -- program end -- Case 1: Working =============== -- xml document start -- <ns1:body xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"> <Nested1> <Nested2> <Nested3/> </Nested2> </Nested1> </ns1:body> -- xml document end -- -- program output start -- <?xml version="1.0" encoding="UTF-8"?> <Nested1> <Nested2> <Nested3/> </Nested2> </Nested1> -- program output end -- Case 2: Failure =============== -- xml document start -- <ns1:body xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"> <Nested1> <Nested2> <Nested3/> <Nested3/> </Nested2> </Nested1> </ns1:body> -- xml document end -- -- program output start -- java.lang.NullPointerException at org.exolab.castor.xml.util.SAX2ANY.endElement(SAX2ANY.java:281) at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:549) at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:918) at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403) at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550) at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149) at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381) at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098) at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:583) at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:491) at de.eds.tmobilesva.enchorusaccess.SendNotification.main(SendNotification.java:109) Exception in thread "main" -- program output end -- ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
