You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by sn...@apache.org on 2002/08/07 23:05:03 UTC

cvs commit: xml-soap/java/src/org/apache/soap/util/xml DOM2Writer.java

snichol     2002/08/07 14:05:03

  Modified:    java/src/org/apache/soap/util/xml DOM2Writer.java
  Log:
  Check prefix and namespace for empty strings as well as nulls.  The xml
  parser with Resin 2.1.1 uses empty strings when no namespace or prefix
  is specified.
  
  Revision  Changes    Path
  1.5       +6 -2      xml-soap/java/src/org/apache/soap/util/xml/DOM2Writer.java
  
  Index: DOM2Writer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/DOM2Writer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOM2Writer.java	1 Sep 2000 03:53:08 -0000	1.4
  +++ DOM2Writer.java	7 Aug 2002 21:05:03 -0000	1.5
  @@ -138,7 +138,10 @@
           String elPrefix = node.getPrefix();
           String elNamespaceURI = node.getNamespaceURI();
   
  -        if (elPrefix != null && elNamespaceURI != null)
  +        // Some XML document builders set prefix and namespace to
  +        // empty strings rather than nulls when not specified.
  +        if (elPrefix != null && elPrefix.length() > 0 &&
  +            elNamespaceURI != null && elNamespaceURI.length() > 0)
           {
             boolean prefixIsDeclared = false;
   
  @@ -174,7 +177,8 @@
             String attrPrefix = attr.getPrefix();
             String attrNamespaceURI = attr.getNamespaceURI();
   
  -          if (attrPrefix != null && attrNamespaceURI != null)
  +          if (attrPrefix != null && attrPrefix.length() > 0 &&
  +              attrNamespaceURI != null && attrNamespaceURI.length() > 0)
             {
               boolean prefixIsDeclared = false;