Hmm, I'd still need to look at your patch in detail, but I wonder whether you can have a look a the patch atached to

http://jira.codehaus.org/browse/CASTOR-2206

and see whether this resolves (all) your prblem(s) ?

Regards
Werner

Markus Schlegel wrote:
Hi
I wrote a Mapping for a custom XPDL file (has some vendor specific
additions in it).
Marshalling works ok, but when I tried tu unmarshal a marshaled file,
I got a "SaxException" stating that a Classdescriptor could not be
Found.
When I debugged the thing, I found out, that the namespaceMapping does
not work, if there are Elements with the same name used in different
Namespaces.
Take the Example:
<activity>
  ....
  <ns1:activity>
    ...
  </ns1:activity>
</activity>

On line 2549 of UnmarshalHandler.getInstanceType(..) the call to
"_cdResolver.resolveByXMLName(..)" returns the classDescriptor of
<activity>, even for <ns1:activity>, because the cache in
"XMLClassDescriptorResolverImpl" has exactly one entry when called and
therefore does not check if the Namespace matches.

I have now added a namespace-check to   UnmarshalHandler.getInstanceType(..).
Instead of :
(Line 2540)
                classDesc = _cdResolver.resolveByXMLName(type,
typeNamespaceURI, _loader);

                if (classDesc != null)
                    return classDesc.getJavaClass().getName();

I now have:
                classDesc = _cdResolver.resolveByXMLName(type,
typeNamespaceURI, _loader);

                if (classDesc != null) { //TODO must check for correct
namespace before...
                  if ((typeNamespaceURI == null) ||
(typeNamespaceURI.length() == 0) || classDesc.getNameSpaceURI() ==
null ||
                      (namespaceEquals(typeNamespaceURI,
classDesc.getNameSpaceURI()))) {
                    return classDesc.getJavaClass().getName();
                  }
                  classDesc=null;
                }


Cheers
Markus Schlegel

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to