axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Aizcorbe (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2257) Attribute namespaces and their prefixes don't appear when Serializing using the writeDomElement() call in SerializationContext
Date Thu, 13 Oct 2005 18:36:04 GMT
Attribute namespaces and their prefixes don't appear when Serializing using the writeDomElement()
call in SerializationContext
------------------------------------------------------------------------------------------------------------------------------

         Key: AXIS-2257
         URL: http://issues.apache.org/jira/browse/AXIS-2257
     Project: Apache Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2.1    
 Environment: Compiling on WinXP box with:
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
    Reporter: Matt Aizcorbe


Found this issue when using the XMLBeanSerializer/XMLBeanDeserializer which leverages the
SerializationContext.writeDOMElement(...).  What happens is I am passing in an Element which
contains attributes from an assortment of namespaces.  The Serialized Document was stripping
the namespaces and prefixes for the elements which was breaking my deserializer.

The issue seems to be in the SerializationContext.startElement(...) starting around line 1128.
 The problem is that no prefix is generated when an attribute has a URI and a qName with no
prefix already defined.  The small else block below fixes the issue.

                if (uri != null && uri.length() > 0) {
                    if (qname.length() == 0) {
                        // If qname isn't set, generate one
                        prefix = getPrefixForURI(uri);
                    } else {
                        // If it is, make sure the prefix looks reasonable.
                        int idx = qname.indexOf(':');
                        if (idx > -1) {
                            prefix = qname.substring(0, idx);
                            prefix = getPrefixForURI(uri,
                                                     prefix, true);
                        }
//start -- added code
                        else {
                            prefix = getPrefixForURI(uri,
                                                     null, true);
                        }
//end -- added code
                    }
                    if (prefix.length() > 0) {
                        qname = prefix + ':' + attributes.getLocalName(i);
                    } else {
                        qname = attributes.getLocalName(i);
                    }
                } else {
                   qname = attributes.getQName(i);
                    if(qname.length() == 0)
                        qname = attributes.getLocalName(i);
                }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message