You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/04/30 07:16:42 UTC

cvs commit: xml-axis/java/src/org/apache/axis/encoding SerializationContext.java

gdaniels    01/04/29 22:16:42

  Modified:    java/src/org/apache/axis/encoding SerializationContext.java
  Log:
  Improve logic of prefix/URI mapping.  Fix a bug where prefixes were not being
  correctly generated.
  
  Revision  Changes    Path
  1.3       +9 -9      xml-axis/java/src/org/apache/axis/encoding/SerializationContext.java
  
  Index: SerializationContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializationContext.java	2001/04/27 15:24:18	1.2
  +++ SerializationContext.java	2001/04/30 05:16:41	1.3
  @@ -113,9 +113,9 @@
           
           if ((uri != null) && (prefix != null) && !prefix.equals("") &&
               !uri.equals("")) {
  -            if ((pendingNSMappings.get(uri) != null) ||
  +            /*if ((pendingNSMappings.get(uri) != null) ||
                   (nsStack.getPrefix(uri) != null))
  -                return;
  +                return;*/
               
               pendingNSMappings.put(uri, prefix);
           }
  @@ -146,12 +146,6 @@
           
           String nsURI = qName.getNamespaceURI();
           
  -        if (!pendingNSMappings.isEmpty()) {
  -            nsStack.push((Hashtable)pendingNSMappings.clone());
  -        } else {
  -            nsStack.push();
  -        }
  -        
           //nsStack.dump();
           
           String elementQName;
  @@ -159,12 +153,18 @@
           buf.append("<");
           
           if ((nsURI != null) && (!nsURI.equals(""))) {
  -            elementQName = nsStack.getPrefix(nsURI) + ":";
  +            elementQName = getPrefixForURI(nsURI) + ":";
           } else {
               elementQName = "";
           }
           elementQName += qName.getLocalPart();
           buf.append(elementQName);
  +        
  +        if (!pendingNSMappings.isEmpty()) {
  +            nsStack.push((Hashtable)pendingNSMappings.clone());
  +        } else {
  +            nsStack.push();
  +        }
           
           if (attributes != null) {
               for (int i = 0; i < attributes.getLength(); i++) {