You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/05/19 06:37:55 UTC

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

duftler     01/05/18 21:37:55

  Modified:    java/src/org/apache/soap Constants.java Utils.java
               java/src/org/apache/soap/encoding SOAPMappingRegistry.java
               java/src/org/apache/soap/encoding/soapenc
                        ArraySerializer.java SoapEncUtils.java
                        UrTypeDeserializer.java
               java/src/org/apache/soap/util/xml DOMUtils.java
  Log:
  Fixed an error message.
  Removed a debug line.
  Some cleanup.
  
  Revision  Changes    Path
  1.18      +9 -9      xml-soap/java/src/org/apache/soap/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Constants.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Constants.java	2001/04/08 13:36:56	1.17
  +++ Constants.java	2001/05/19 04:37:50	1.18
  @@ -99,7 +99,7 @@
       NS_URI_1999_SCHEMA_XSI;
     public static final String NS_URI_CURRENT_SCHEMA_XSD =
       NS_URI_1999_SCHEMA_XSD;
  -  
  +
     public static final String NS_URI_XML_SOAP =
       "http://xml.apache.org/xml-soap";
     public static final String NS_URI_XML_SOAP_DEPLOYMENT =
  @@ -151,13 +151,13 @@
     public static final String ELEM_FAULT_DETAIL_ENTRY = "detailEntry";
   
     // Qualified element names.
  -  public static QName  Q_ELEM_ENVELOPE =
  +  public static QName Q_ELEM_ENVELOPE =
       new QName(NS_URI_SOAP_ENV, ELEM_ENVELOPE);
  -  public static QName  Q_ELEM_HEADER =
  +  public static QName Q_ELEM_HEADER =
       new QName(NS_URI_SOAP_ENV, ELEM_HEADER);
  -  public static QName  Q_ELEM_BODY =
  +  public static QName Q_ELEM_BODY =
       new QName(NS_URI_SOAP_ENV, ELEM_BODY);
  -  public static QName  Q_ELEM_FAULT =
  +  public static QName Q_ELEM_FAULT =
       new QName(NS_URI_SOAP_ENV, ELEM_FAULT);
   
     // Attribute names.
  @@ -170,7 +170,7 @@
     public static final String ATTR_ID = "id";
   
     // Qualified attribute names.
  -  public static QName  Q_ATTR_MUST_UNDERSTAND =
  +  public static QName Q_ATTR_MUST_UNDERSTAND =
       new QName(NS_URI_SOAP_ENV, ATTR_MUST_UNDERSTAND);
   
     // Attribute values.
  @@ -211,7 +211,7 @@
     //////////////////////////////////////////////////////
     // Type QNames for the various schemas
     public static final QName string1999QName =
  -      new QName(Constants.NS_URI_1999_SCHEMA_XSD, "string");
  +    new QName(Constants.NS_URI_1999_SCHEMA_XSD, "string");
     public static final QName int1999QName =
       new QName(Constants.NS_URI_1999_SCHEMA_XSD, "int");
     public static final QName float1999QName =
  @@ -236,7 +236,7 @@
       new QName(Constants.NS_URI_1999_SCHEMA_XSD, "ur-type");
   
     public static final QName string2000QName =
  -      new QName(Constants.NS_URI_2000_SCHEMA_XSD, "string");
  +    new QName(Constants.NS_URI_2000_SCHEMA_XSD, "string");
     public static final QName int2000QName =
       new QName(Constants.NS_URI_2000_SCHEMA_XSD, "int");
     public static final QName float2000QName =
  @@ -261,7 +261,7 @@
       new QName(Constants.NS_URI_2000_SCHEMA_XSD, "anyType");
   
     public static final QName string2001QName =
  -      new QName(Constants.NS_URI_2001_SCHEMA_XSD, "string");
  +    new QName(Constants.NS_URI_2001_SCHEMA_XSD, "string");
     public static final QName int2001QName =
       new QName(Constants.NS_URI_2001_SCHEMA_XSD, "int");
     public static final QName float2001QName =
  
  
  
  1.8       +14 -7     xml-soap/java/src/org/apache/soap/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Utils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Utils.java	2001/05/17 18:25:38	1.7
  +++ Utils.java	2001/05/19 04:37:50	1.8
  @@ -171,13 +171,20 @@
      */
     public static void checkMustUnderstands(Header header) throws SOAPException
     {
  -      System.out.println("Checking mustUnderstands...");
  -      Vector entries = header.getHeaderEntries();
  -      for (int i = 0; i < entries.size(); i++) {
  -          Element el = (Element)entries.elementAt(i);
  -          String val = el.getAttributeNS(Constants.NS_URI_SOAP_ENV, Constants.ATTR_MUST_UNDERSTAND);
  -          if (val != null && val.equals("1"))
  -              throw new SOAPException("mustUnderstand", "Didn't understand header '" + el.getLocalName() + "'");
  +    Vector entries = header.getHeaderEntries();
  +
  +    for (int i = 0; i < entries.size(); i++)
  +    {
  +      Element el = (Element)entries.elementAt(i);
  +      String val = el.getAttributeNS(Constants.NS_URI_SOAP_ENV,
  +                                     Constants.ATTR_MUST_UNDERSTAND);
  +
  +      if (val != null && val.equals("1"))
  +      {
  +        throw new SOAPException("mustUnderstand",
  +                                "Didn't understand header '" +
  +                                el.getLocalName() + "'");
         }
  +    }
     }
   }
  
  
  
  1.19      +34 -26    xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java
  
  Index: SOAPMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SOAPMappingRegistry.java	2001/05/18 03:14:42	1.18
  +++ SOAPMappingRegistry.java	2001/05/19 04:37:51	1.19
  @@ -106,7 +106,8 @@
     private final CalendarSerializer calSer = new CalendarSerializer();
     private final UrTypeDeserializer objDeser = new UrTypeDeserializer();
     
  -  /** The following stuff is here to deal with the slight differences
  +  /**
  +   * The following stuff is here to deal with the slight differences
      * between 1999 schema and 2000/10 schema.  This system allows us to
      * register type mappings for both sets of QNames, and to default to
      * whichever one is set as current.
  @@ -219,28 +220,28 @@
       javax.activation.DataSource.class,
       javax.activation.DataHandler.class,
       Object.class,
  -    };
  +  };
     
     Serializer ser = new Serializer()
  -    {
  -      public void marshall(String inScopeEncStyle, Class javaType, Object src,
  -                           Object context, Writer sink, NSStack nsStack,
  -                           XMLJavaMappingRegistry xjmr, SOAPContext ctx)
  -        throws IllegalArgumentException, IOException {
  -        nsStack.pushScope();
  -
  -        SoapEncUtils.generateStructureHeader(inScopeEncStyle,
  -                                             javaType,
  -                                             context,
  -                                             sink,
  -                                             nsStack,
  -                                             xjmr);
  -
  -        sink.write(Utils.cleanString(src.toString()) + "</" + context + '>');
  -
  -        nsStack.popScope();
  -      }
  -    };
  +  {
  +    public void marshall(String inScopeEncStyle, Class javaType, Object src,
  +                         Object context, Writer sink, NSStack nsStack,
  +                         XMLJavaMappingRegistry xjmr, SOAPContext ctx)
  +      throws IllegalArgumentException, IOException {
  +      nsStack.pushScope();
  +
  +      SoapEncUtils.generateStructureHeader(inScopeEncStyle,
  +                                           javaType,
  +                                           context,
  +                                           sink,
  +                                           nsStack,
  +                                           xjmr);
  +
  +      sink.write(Utils.cleanString(src.toString()) + "</" + context + '>');
  +
  +      nsStack.popScope();
  +    }
  +  };
   
     Serializer serializers [] = {
       ser,
  @@ -292,13 +293,18 @@
       null,
       null,
       objDeser,
  -    };
  -  
  +  };
  +
     public SOAPMappingRegistry()
     {
       this(Constants.NS_URI_CURRENT_SCHEMA_XSD);
     }
  -  
  +
  +  /**
  +   * Sets up serializers for the specified Schema typeset.
  +   * @param schemaURI Should be one of Constants.NS_URI_1999_SCHEMA_XSD,
  +   * Constants.NS_URI_2000_SCHEMA_XSD, or Constants.NS_URI_2001_SCHEMA_XSD.
  +   */
     public SOAPMappingRegistry(String schemaURI)
     {
       // Set up the correct "current" schema typeset.
  @@ -316,7 +322,8 @@
         mapSchemaTypes(schema2000QNames, false);
       } else {
         System.out.println("WARNING: Unrecognized Schema URI '" + schemaURI +
  -                         "' specified.  Defaulting to ");
  +                         "' specified.  Defaulting to '" + this.schemaURI +
  +                         "'.");
       }
       
       mapSchemaTypes(schemaQNames, true);
  @@ -381,7 +388,8 @@
       mapTypes(soapEncURI, base64QName, byte[].class, base64Ser, base64Ser);
     }
     
  -  /** Map a set of schema types defined in the arrays above.  If
  +  /**
  +   * Map a set of schema types defined in the arrays above.  If
      * the "serialize" arg is set to true, we'll map the serializer
      * side (i.e. when output gets generated it'll be as those QNames),
      * otherwise we just do deserializers.
  
  
  
  1.8       +2 -2      xml-soap/java/src/org/apache/soap/encoding/soapenc/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/soapenc/ArraySerializer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ArraySerializer.java	2001/05/11 17:38:08	1.7
  +++ ArraySerializer.java	2001/05/19 04:37:52	1.8
  @@ -172,11 +172,11 @@
         QName actualItemType = declItemType != null
                                ? declItemType
                                : arrayItemType;
  -	  
  +
         // If it's a local reference, follow it.
         String href = tempEl.getAttribute(Constants.ATTR_REFERENCE);
         Element actualEl = tempEl;
  -      
  +
         if(href != null && !href.equals("") && (href.charAt(0) == '#'))
         {
           href = href.substring(1);
  
  
  
  1.7       +2 -2      xml-soap/java/src/org/apache/soap/encoding/soapenc/SoapEncUtils.java
  
  Index: SoapEncUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/soapenc/SoapEncUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SoapEncUtils.java	2001/05/11 17:38:19	1.6
  +++ SoapEncUtils.java	2001/05/19 04:37:52	1.7
  @@ -244,9 +244,9 @@
       }
     }
   
  -  /** Get the value of the xsi:type attribute, for varying values of
  +  /**
  +   * Get the value of the xsi:type attribute, for varying values of
      * the xsi namespace.
  -   * 
      */
     public static QName getTypeQName(Element el)
       throws IllegalArgumentException
  
  
  
  1.3       +2 -1      xml-soap/java/src/org/apache/soap/encoding/soapenc/UrTypeDeserializer.java
  
  Index: UrTypeDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/soapenc/UrTypeDeserializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UrTypeDeserializer.java	2001/03/19 06:20:51	1.2
  +++ UrTypeDeserializer.java	2001/05/19 04:37:53	1.3
  @@ -83,6 +83,7 @@
       throws IllegalArgumentException
     {
   	  Element root = (Element)src;
  +
   	  if (!SoapEncUtils.isNull(root)) {
         String href = root.getAttribute(Constants.ATTR_REFERENCE);
         if (href != null && !href.equals(""))
  @@ -95,6 +96,6 @@
         throw new IllegalArgumentException("Can't yet deserialize non-null Objects");
   	  }
   
  -      return new Bean(Object.class, null);
  +    return new Bean(Object.class, null);
     }
   }
  
  
  
  1.4       +4 -0      xml-soap/java/src/org/apache/soap/util/xml/DOMUtils.java
  
  Index: DOMUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/DOMUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMUtils.java	2001/03/19 06:20:52	1.3
  +++ DOMUtils.java	2001/05/19 04:37:54	1.4
  @@ -59,6 +59,10 @@
   
   import org.w3c.dom.*;
   
  +/**
  + * @author Matthew J. Duftler
  + * @author Sanjiva Weerawarana
  + */
   public class DOMUtils {
     /**
      * The namespaceURI represented by the prefix <code>xmlns</code>.