Title: Message
Hi Harald,

It sounds definitely like a bug. Have you tried against the CVS version which contains some fixes for SAX2ANY?
If you still experience a problem with the CVS version then I advise you to file a bug in bugzilla.

Sorry for the inconvenience,

Arnaud
 
 


This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately.

-----Original Message-----
From: Harald Bernkopf [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 3:50 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] storing dom Element in member var

Hi Erik,
 
I want to make the same as Alan and I tried to do it the same way you wrote as solution:
 
I want to create a Java object representation of XML with <any> in my  schema:
 

<xsd:element name="xxx" type="xxxType"/>

<xsd:complexType name="xxxType">

<xsd:sequence>

<xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />

</xsd:sequence>

</xsd:complexType >

Generating the java-stubs worked correctly. The generated bean als contains a property "private java.util.ArrayList _anyObject;" which seams to be correct.

Then I tried to unmarshal a test-xml wich worked correctly:

<xxx>

    <MyData>

        <aaa>111</aaa>

    </MyData>

</xxx>

Now the problem with the following XML:

<xxx>

    <MyData>

        <aaa>111</aaa>

        <bbb>222</bbb>

    </MyData>

</xxx>

 

When unmarshalling the xml-file I receive a NullpointerException in SAX2Any.java when endelement of 'MyData' is called. (the endElement-calls of 'aaa' and 'bbb' just before are correct):

public void endElement(String name)

throws SAXException

{

String prefix = "";

String namespaceURI = null;

int idx = name.indexOf(':');

if (idx >= 0) {

prefix = name.substring(0,idx);

}

----->>>>namespaceURI = _context.getNamespaceURI(prefix); <<<<--------------

endElement(namespaceURI,getLocalPart(name), name);

_context = _context.getParent();

}

The _context is null. I don't understand, where the _context get lost, so that it is at this point null.

Do I have to change the schma or is it a bug ?

Thanks for any help!!!

Harald.

Reply via email to