You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2002/02/17 07:02:47 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers AbstractSAXParser.java

andyc       02/02/16 22:02:47

  Modified:    java/src/org/apache/xerces/parsers AbstractSAXParser.java
  Log:
  The abstract SAX parser class depended on the symbol table in
  the configuration so that it could remove namespace binding
  attributes based on the namespace-prefixes feature. But, if
  the configuration doesn't have a symbol table, then the
  symbols are null and it ends up removing *all* of document's
  attributes that aren't in namespaces. Oops. So I removed the
  dependency and changed it to perform an "equals" comparison
  instead.
  
  Revision  Changes    Path
  1.23      +9 -29     xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
  
  Index: AbstractSAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractSAXParser.java	29 Jan 2002 23:16:43 -0000	1.22
  +++ AbstractSAXParser.java	17 Feb 2002 06:02:47 -0000	1.23
  @@ -67,7 +67,6 @@
   
   import org.apache.xerces.util.EntityResolverWrapper;
   import org.apache.xerces.util.ErrorHandlerWrapper;
  -import org.apache.xerces.util.SymbolTable;
   
   import org.apache.xerces.xni.Augmentations;
   import org.apache.xerces.xni.QName;
  @@ -112,7 +111,7 @@
    * @author Arnaud Le Hors, IBM
    * @author Andy Clark, IBM
    *
  - * @version $Id: AbstractSAXParser.java,v 1.22 2002/01/29 23:16:43 sandygao Exp $
  + * @version $Id: AbstractSAXParser.java,v 1.23 2002/02/17 06:02:47 andyc Exp $
    */
   public abstract class AbstractSAXParser
       extends AbstractXMLDocumentParser
  @@ -137,12 +136,6 @@
       protected static final String NORMALIZE_DATA = 
           Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_NORMALIZED_VALUE;
   
  -    // NOTE: The symbol table properties is for internal use. -Ac
  -
  -    /** Property identifier: symbol table. */
  -    protected static final String SYMBOL_TABLE =
  -        Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
  -
       //
       // Data
       //
  @@ -177,12 +170,6 @@
   
       protected QName fQName = new QName();
   
  -    // symbols
  -
  -    /** Symbol: empty string (""). */
  -    private String fEmptySymbol;
  -    private String fXmlnsSymbol;
  -
       // state
   
       /**
  @@ -420,8 +407,8 @@
                           }
                       }
   
  -                    if (fQName.prefix == fXmlnsSymbol || 
  -                        fQName.rawname == fXmlnsSymbol) {
  +                    if ((fQName.prefix != null && fQName.prefix.equals("xmlns")) || 
  +                        fQName.rawname.equals("xmlns")) {
                           if (!fNamespacePrefixes) {
                               // remove namespace declaration attributes
                               attributes.removeAttributeAt(i);
  @@ -429,8 +416,8 @@
                           if (fNamespaces && fNamespacePrefixes) {
                               // localpart should be empty string as per SAX documentation:
                               // http://www.saxproject.org/?selected=namespaces
  -                            fQName.prefix = fEmptySymbol;
  -                            fQName.localpart = fEmptySymbol;
  +                            fQName.prefix = "";
  +                            fQName.localpart = "";
                               attributes.setName(i, fQName);
                           }
                       } 
  @@ -439,8 +426,8 @@
                     
                   }
                   
  -                String uri = element.uri != null ? element.uri : fEmptySymbol;
  -                String localpart = fNamespaces ? element.localpart : fEmptySymbol;
  +                String uri = element.uri != null ? element.uri : "";
  +                String localpart = fNamespaces ? element.localpart : "";
                   fAttributesProxy.setAttributes(attributes);
                   fContentHandler.startElement(uri, localpart, element.rawname,
                                                fAttributesProxy);
  @@ -563,8 +550,8 @@
   
               // SAX2
               if (fContentHandler != null) {
  -                String uri = element.uri != null ? element.uri : fEmptySymbol;
  -                String localpart = fNamespaces ? element.localpart : fEmptySymbol;
  +                String uri = element.uri != null ? element.uri : "";
  +                String localpart = fNamespaces ? element.localpart : "";
                   fContentHandler.endElement(uri, localpart,
                                              element.rawname);
               }
  @@ -1891,13 +1878,6 @@
           fNamespacePrefixes = fConfiguration.getFeature(NAMESPACE_PREFIXES);
           fNormalizeData = fConfiguration.getFeature(NORMALIZE_DATA);
           
  -        // save needed symbols
  -        SymbolTable symbolTable = (SymbolTable)fConfiguration.getProperty(SYMBOL_TABLE);
  -        if (symbolTable != null) {
  -            fEmptySymbol = symbolTable.addSymbol("");
  -            fXmlnsSymbol = symbolTable.addSymbol("xmlns");
  -        }
  -
       } // reset()
   
       //
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org