axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/encoding/ser QNameSerializer.java SimpleListSerializer.java
Date Tue, 16 Nov 2004 05:21:00 GMT
gawor       2004/11/15 21:21:00

  Modified:    java/src/org/apache/axis/encoding/ser QNameSerializer.java
                        SimpleListSerializer.java
  Log:
  a fix for qname serialization when a default namespace is set
  
  Revision  Changes    Path
  1.11      +18 -2     ws-axis/java/src/org/apache/axis/encoding/ser/QNameSerializer.java
  
  Index: QNameSerializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/QNameSerializer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- QNameSerializer.java	25 Feb 2004 14:02:37 -0000	1.10
  +++ QNameSerializer.java	16 Nov 2004 05:21:00 -0000	1.11
  @@ -46,10 +46,26 @@
           context.endElement();
       }
   
  -    public String getValueAsString(Object value, SerializationContext context) {
  -        return context.qName2String((QName)value);
  +    public static String qName2String(QName qname, 
  +                                      SerializationContext context) {
  +        String str = context.qName2String(qname);
  +        // work around for default namespace
  +        if (str == qname.getLocalPart()) {
  +            String namespace = qname.getNamespaceURI();
  +            if (namespace != null && namespace.length() > 0) {
  +                String prefix = 
  +                    context.getPrefixForURI(qname.getNamespaceURI(), 
  +                                            null, true);
  +                return prefix + ":" + str;
  +            }
  +        }
  +        return str;
       }
   
  +    public String getValueAsString(Object value, SerializationContext context) {
  +        return qName2String((QName)value, context);
  +    }
  +    
       public String getMechanismType() { return Constants.AXIS_SAX; }
   
       /**
  
  
  
  1.4       +1 -1      ws-axis/java/src/org/apache/axis/encoding/ser/SimpleListSerializer.java
  
  Index: SimpleListSerializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleListSerializer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleListSerializer.java	23 Mar 2004 10:45:06 -0000	1.3
  +++ SimpleListSerializer.java	16 Nov 2004 05:21:00 -0000	1.4
  @@ -116,7 +116,7 @@
             }
           } 
           else if (object instanceof QName) {
  -          result.append( context.qName2String((QName)object) );
  +          result.append(QNameSerializer.qName2String((QName)object, context));
           }
           else {
             result.append(object.toString());
  
  
  

Mime
View raw message