You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/09/25 01:05:19 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/xni NamespaceContext.java XMLDocumentHandler.java

elena       2002/09/24 16:05:19

  Modified:    java/src/org/apache/xerces/dom DOMNormalizer.java
               java/src/org/apache/xerces/impl Constants.java
                        XMLDocumentScannerImpl.java
                        XMLNSDocumentScannerImpl.java
                        XMLNamespaceBinder.java
               java/src/org/apache/xerces/impl/dtd XMLDTDValidator.java
                        XMLNSDTDValidator.java
               java/src/org/apache/xerces/impl/validation
                        ValidationState.java
               java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
               java/src/org/apache/xerces/impl/xs/dom DOMParser.java
               java/src/org/apache/xerces/parsers AbstractDOMParser.java
                        AbstractSAXParser.java
                        AbstractXMLDocumentParser.java
                        BasicParserConfiguration.java
               java/src/org/apache/xerces/util
                        ParserConfigurationSettings.java
               java/src/org/apache/xerces/xni NamespaceContext.java
                        XMLDocumentHandler.java
  Log:
  Add xni.NamespaceContext to the XMLDocumentHandler.startDocument() and update
  the implementation accordingly.
  Set default for  validation/schema feature in XMLSchemaValidator component
  to true.
  Modify docs for xni.NamespaceContext.
  
  Revision  Changes    Path
  1.16      +16 -35    xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java
  
  Index: DOMNormalizer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DOMNormalizer.java	23 Sep 2002 16:44:42 -0000	1.15
  +++ DOMNormalizer.java	24 Sep 2002 23:05:16 -0000	1.16
  @@ -172,7 +172,7 @@
       protected boolean fNamespaceValidation = false;
   
       /** stores namespaces in scope */
  -    protected final NamespaceSupport fNamespaceBinder = new NamespaceSupport();
  +    protected final NamespaceSupport fNamespaceContext = new NamespaceSupport();
   
       /** stores all namespace bindings on the current element */
       protected final NamespaceSupport fLocalNSBinder = new NamespaceSupport();
  @@ -207,8 +207,8 @@
           }
   
           fNamespaceValidation = componentManager.getFeature(DOMValidationConfiguration.SCHEMA);
  -        fNamespaceBinder.reset();
  -        fNamespaceBinder.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
  +        fNamespaceContext.reset();
  +        fNamespaceContext.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
           fNamespaceCounter = 1;
   
           if (fValidationHandler != null) {
  @@ -237,7 +237,7 @@
   
           if (fValidationHandler != null) {
               fValidationHandler.setBaseURI(fDocument.fDocumentURI);
  -            fValidationHandler.startDocument(null, fDocument.encoding, null);
  +            fValidationHandler.startDocument(null, fDocument.encoding, fNamespaceContext, null);
           }
   
           Node kid, next;
  @@ -295,7 +295,7 @@
                       System.out.println("==>normalizeNode:{element} "+node.getNodeName());
                   }
                   // push namespace context
  -                fNamespaceBinder.pushContext();
  +                fNamespaceContext.pushContext();
   
                   ElementImpl elem = (ElementImpl)node;
                   if (elem.needsSyncChildren()) {
  @@ -364,15 +364,10 @@
                       fDocument.fErrorHandlerWrapper.fCurrentNode = node;
   
                       fValidationHandler.endElement(fQName, null);
  -                    int count = fNamespaceBinder.getDeclaredPrefixCount();
  -                    for (int i = count - 1; i >= 0; i--) {
  -                        String prefix = fNamespaceBinder.getDeclaredPrefixAt(i);
  -                        fValidationHandler.endPrefixMapping(prefix, null);
  -                    }
                   }
   
                   // pop namespace context
  -                fNamespaceBinder.popContext();
  +                fNamespaceContext.popContext();
   
                   break;
               }
  @@ -592,12 +587,9 @@
   
                               value = fSymbolTable.addSymbol(value);
                               if (value.length() != 0) {
  -                                fNamespaceBinder.declarePrefix(localpart, value);
  +                                fNamespaceContext.declarePrefix(localpart, value);
                                   fLocalNSBinder.declarePrefix(localpart, value);
   
  -                                if (fValidationHandler != null) {
  -                                    fValidationHandler.startPrefixMapping(localpart, value, null);
  -                                }
                               } else {
                                   // REVISIT: issue error on invalid declarations
                                   //          xmlns:foo = ""
  @@ -609,7 +601,7 @@
                               // empty prefix is always bound ("" or some string)
                               value = fSymbolTable.addSymbol(value);
                               fLocalNSBinder.declarePrefix(XMLSymbols.EMPTY_STRING, value);
  -                            fNamespaceBinder.declarePrefix(XMLSymbols.EMPTY_STRING, value);
  +                            fNamespaceContext.declarePrefix(XMLSymbols.EMPTY_STRING, value);
   
                               if (fValidationHandler != null) {
                                   fValidationHandler.startPrefixMapping(XMLSymbols.EMPTY_STRING, value, null);
  @@ -646,7 +638,7 @@
               uri = fSymbolTable.addSymbol(uri);
               prefix = (prefix == null || 
                         prefix.length() == 0) ? XMLSymbols.EMPTY_STRING :fSymbolTable.addSymbol(prefix);
  -            if (fNamespaceBinder.getURI(prefix) == uri) {
  +            if (fNamespaceContext.getURI(prefix) == uri) {
                   // The xmlns:prefix=namespace or xmlns="default" was declared at parent.
                   // The binder always stores mapping of empty prefix to "".
               } else {
  @@ -655,11 +647,7 @@
                   // conflict: the prefix is bound to another URI
                   addNamespaceDecl(prefix, uri, element);
                   fLocalNSBinder.declarePrefix(prefix, uri);
  -                fNamespaceBinder.declarePrefix(prefix, uri);
  -                // send startPrefixMapping call 
  -                if (fValidationHandler != null) {
  -                    fValidationHandler.startPrefixMapping(prefix, uri, null);
  -                }
  +                fNamespaceContext.declarePrefix(prefix, uri);
               }
           } else { // Element has no namespace
               String tagName = element.getNodeName();
  @@ -681,16 +669,13 @@
                       throw new RuntimeException("DOM Level 1 node: "+tagName);
                   }
               } else { // uri=null and no colon (DOM L2 node)
  -                uri = fNamespaceBinder.getURI(XMLSymbols.EMPTY_STRING);
  +                uri = fNamespaceContext.getURI(XMLSymbols.EMPTY_STRING);
                   if (uri !=null && uri.length() > 0) {
                       // undeclare default namespace declaration (before that element
                       // bound to non-zero length uir), but adding xmlns="" decl                    
                       addNamespaceDecl (XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING, element);
                       fLocalNSBinder.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
  -                    fNamespaceBinder.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
  -                    if (fValidationHandler != null) {
  -                        fValidationHandler.startPrefixMapping(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING, null);
  -                    }
  +                    fNamespaceContext.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
                   }
               }
           }
  @@ -748,7 +733,7 @@
                       uri = fSymbolTable.addSymbol(uri);
   
                       // find if for this prefix a URI was already declared
  -                    String declaredURI =  fNamespaceBinder.getURI(prefix);
  +                    String declaredURI =  fNamespaceContext.getURI(prefix);
   
                       if (prefix == XMLSymbols.EMPTY_STRING || declaredURI != uri) {
                           // attribute has no prefix (default namespace decl does not apply to attributes) 
  @@ -761,7 +746,7 @@
                           name  = attr.getNodeName();
                           // Find if any prefix for attributes namespace URI is available
                           // in the scope
  -                        String declaredPrefix = fNamespaceBinder.getPrefix(uri);
  +                        String declaredPrefix = fNamespaceContext.getPrefix(uri);
                           if (declaredPrefix !=null && declaredPrefix !=XMLSymbols.EMPTY_STRING) {
   
                               // use the prefix that was found (declared previously for this URI
  @@ -785,11 +770,7 @@
                               addNamespaceDecl(prefix, uri, element);
                               value = fSymbolTable.addSymbol(value);
                               fLocalNSBinder.declarePrefix(prefix, value);
  -                            fNamespaceBinder.declarePrefix(prefix, uri);
  -
  -                            if (fValidationHandler != null) {
  -                                fValidationHandler.startPrefixMapping(prefix, uri, null);
  -                            }
  +                            fNamespaceContext.declarePrefix(prefix, uri);
                           }
   
                           // change prefix for this attribute
  
  
  
  1.22      +1 -4      xml-xerces/java/src/org/apache/xerces/impl/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Constants.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Constants.java	18 Sep 2002 21:55:16 -0000	1.21
  +++ Constants.java	24 Sep 2002 23:05:16 -0000	1.22
  @@ -306,9 +306,6 @@
       /** Validation manager property ("internal/validation-manager"). */
       public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
   
  -    /** Validation manager property ("internal/namespace-context"). */
  -    public static final String NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context";
  -
       // general constants
   
       /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
  
  
  
  1.25      +11 -12    xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java
  
  Index: XMLDocumentScannerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- XMLDocumentScannerImpl.java	24 Sep 2002 09:39:44 -0000	1.24
  +++ XMLDocumentScannerImpl.java	24 Sep 2002 23:05:17 -0000	1.25
  @@ -67,6 +67,7 @@
   import org.apache.xerces.impl.msg.XMLMessageFormatter;
   import org.apache.xerces.impl.validation.ValidationManager;
   
  +import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.XMLAttributesImpl;
   import org.apache.xerces.util.XMLStringBuffer;
   import org.apache.xerces.util.XMLResourceIdentifierImpl;
  @@ -155,10 +156,6 @@
       protected static final String VALIDATION_MANAGER =
           Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
   
  -    /** Internal property: namespace context */
  -    protected static final String NAMESPACE_CONTEXT_PROPERTY =
  -        Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
  -
       // recognized features and properties
   
       /** Recognized features. */
  @@ -174,15 +171,13 @@
       /** Recognized properties. */
       private static final String[] RECOGNIZED_PROPERTIES = {
           DTD_SCANNER,
  -        VALIDATION_MANAGER,
  -        NAMESPACE_CONTEXT_PROPERTY
  +        VALIDATION_MANAGER
       };
   
       /** Property defaults. */
       private static final Object[] PROPERTY_DEFAULTS = {
           null,
  -        null,
  -        null,
  +        null
       };
   
       //
  @@ -212,6 +207,9 @@
       /** Doctype declaration system identifier. */
       protected String fDoctypeSystemId;
   
  +    /** Namespace support. */
  +    protected NamespaceSupport fNamespaceContext = new NamespaceSupport();
  +
       // features
   
       /** Load external DTD. */
  @@ -299,6 +297,7 @@
           fDoctypePublicId = null;
           fDoctypeSystemId = null;
           fSeenDoctypeDecl = false;
  +        fNamespaceContext.reset();
   
           // xerces features
           try {
  @@ -319,7 +318,7 @@
   
           // initialize vars
           fScanningDTD = false;
  -
  +        
           // setup dispatcher
           setScannerState(SCANNER_STATE_XML_DECL);
           setDispatcher(fXMLDeclDispatcher);
  @@ -430,6 +429,7 @@
        * @since Xerces 2.2.0
        */
       public Boolean getFeatureDefault(String featureId) {
  +
           for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
               if (RECOGNIZED_FEATURES[i].equals(featureId)) {
                   return FEATURE_DEFAULTS[i];
  @@ -488,7 +488,7 @@
   
           // call handler
           if (fDocumentHandler != null && name.equals("[xml]")) {
  -            fDocumentHandler.startDocument(fEntityScanner, encoding, null);
  +            fDocumentHandler.startDocument(fEntityScanner, encoding, fNamespaceContext, null);
           }
   
       } // startEntity(String,identifier,String)
  @@ -776,7 +776,6 @@
                                   setDispatcher(fDTDDispatcher);
                                   return true;
                               }
  -
                               if (fDoctypeSystemId != null && ((fValidation || fLoadExternalDTD) 
                                       && (fValidationManager == null || !fValidationManager.isCachedDTD()))) {
                                   setScannerState(SCANNER_STATE_DTD_EXTERNAL);
  
  
  
  1.4       +13 -19    xml-xerces/java/src/org/apache/xerces/impl/XMLNSDocumentScannerImpl.java
  
  Index: XMLNSDocumentScannerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLNSDocumentScannerImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLNSDocumentScannerImpl.java	16 Sep 2002 21:36:40 -0000	1.3
  +++ XMLNSDocumentScannerImpl.java	24 Sep 2002 23:05:17 -0000	1.4
  @@ -64,7 +64,6 @@
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.XMLSymbols;
   
  -import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.XMLAttributesImpl;
   import org.apache.xerces.util.XMLChar;
  @@ -119,8 +118,6 @@
         *   scanner if DTD grammar is missing.*/
       protected boolean fPerformValidation;
   
  -    /** Namespace support. */
  -    protected NamespaceSupport fNamespaceSupport = null;
       protected String[] fUri= new String[4];
       protected String[] fLocalpart = new String[4];
       protected int fLength = 0;
  @@ -183,7 +180,7 @@
           // Note: namespace processing is on by default 
           fEntityScanner.scanQName(fElementQName);
           if (fBindNamespaces) {
  -            fNamespaceSupport.pushContext();
  +            fNamespaceContext.pushContext();
               rawname = fElementQName.rawname;
               if (fScannerState == SCANNER_STATE_ROOT_ELEMENT) {
                   if (fPerformValidation) {
  @@ -250,7 +247,7 @@
               String prefix = fElementQName.prefix != null
                               ? fElementQName.prefix : XMLSymbols.EMPTY_STRING;
   
  -            fElementQName.uri = fNamespaceSupport.getURI(prefix);
  +            fElementQName.uri = fNamespaceContext.getURI(prefix);
               if (fElementQName.prefix == null && fElementQName.uri != null) {
                   fElementQName.prefix = XMLSymbols.EMPTY_STRING;
               }
  @@ -269,7 +266,7 @@
   
                   String aprefix = fAttributeQName.prefix != null
                                    ? fAttributeQName.prefix : XMLSymbols.EMPTY_STRING;
  -                String uri = fNamespaceSupport.getURI(aprefix);
  +                String uri = fNamespaceContext.getURI(aprefix);
                   // REVISIT: try removing the first "if" and see if it is faster.
                   //           
                   if (fAttributeQName.uri != null && fAttributeQName.uri == uri) {
  @@ -299,13 +296,13 @@
                   // handleEndElement(fElementQName, null);
   
                   if (fBindNamespaces) {
  -                    int count = fNamespaceSupport.getDeclaredPrefixCount();
  +                    int count = fNamespaceContext.getDeclaredPrefixCount();
   
                       for (int i = count - 1; i >= 0; i--) {
  -                        String prefix = fNamespaceSupport.getDeclaredPrefixAt(i);
  +                        String prefix = fNamespaceContext.getDeclaredPrefixAt(i);
                           fDocumentHandler.endPrefixMapping(prefix, null);
                       }
  -                    fNamespaceSupport.popContext();
  +                    fNamespaceContext.popContext();
                   }
   
                   //decrease the markup depth..
  @@ -480,9 +477,9 @@
                   }
   
                   // declare prefix in context
  -                fNamespaceSupport.declarePrefix(prefix, uri.length() != 0 ? uri : null);
  +                fNamespaceContext.declarePrefix(prefix, uri.length() != 0 ? uri : null);
                   // bind namespace attribute to a namespace
  -                attributes.setURI(oldLen, fNamespaceSupport.getURI(XMLSymbols.PREFIX_XMLNS));
  +                attributes.setURI(oldLen, fNamespaceContext.getURI(XMLSymbols.PREFIX_XMLNS));
   
                   // call handler
                   if (fDocumentHandler != null) {
  @@ -492,7 +489,7 @@
               else {
                   // attempt to bind attribute
                   if (fAttributeQName.prefix != null) {
  -                    attributes.setURI(oldLen, fNamespaceSupport.getURI(fAttributeQName.prefix));
  +                    attributes.setURI(oldLen, fNamespaceContext.getURI(fAttributeQName.prefix));
                   }
               }
           }
  @@ -557,12 +554,12 @@
   
               fDocumentHandler.endElement(fElementQName, null);
               if (fBindNamespaces) {
  -                int count = fNamespaceSupport.getDeclaredPrefixCount();
  +                int count = fNamespaceContext.getDeclaredPrefixCount();
                   for (int i = count - 1; i >= 0; i--) {
  -                    String prefix = fNamespaceSupport.getDeclaredPrefixAt(i);
  +                    String prefix = fNamespaceContext.getDeclaredPrefixAt(i);
                       fDocumentHandler.endPrefixMapping(prefix, null);
                   }
  -                fNamespaceSupport.popContext();
  +                fNamespaceContext.popContext();
               }
   
           }
  @@ -578,9 +575,6 @@
           super.reset(componentManager);
           fPerformValidation = false;
           fBindNamespaces = false;
  -
  -        // internal xerces property: namespace context
  -        fNamespaceSupport = (NamespaceSupport)componentManager.getProperty(NAMESPACE_CONTEXT_PROPERTY);
       }
   
       /** Creates a content dispatcher. */
  
  
  
  1.24      +16 -6     xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java
  
  Index: XMLNamespaceBinder.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLNamespaceBinder.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- XMLNamespaceBinder.java	24 Sep 2002 09:39:44 -0000	1.23
  +++ XMLNamespaceBinder.java	24 Sep 2002 23:05:17 -0000	1.24
  @@ -177,7 +177,7 @@
       // namespaces
   
       /** Namespace support. */
  -    protected NamespaceSupport fNamespaceSupport = null;
  +    protected NamespaceSupport fNamespaceSupport = new NamespaceSupport();
   
       // settings
   
  @@ -279,9 +279,7 @@
           // Xerces properties
           fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
           fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
  -        fNamespaceSupport = (NamespaceSupport)componentManager.getProperty(NAMESPACE_CONTEXT_PROPERTY);
   
  -        // initialize vars
           fNamespaceSupport.reset();
   
           // use shared context
  @@ -487,14 +485,26 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs     Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs)
           throws XNIException {
  +        // REVISIT: in the namespace binder we should be able to modify the namespace
  +        //          context object, thus for now we are dropping the namespaceContext
  +        //          Not sure this is a correct behaviour....
           if (fDocumentHandler != null && !fOnlyPassPrefixMappingEvents) {
  -            fDocumentHandler.startDocument(locator, encoding, augs);
  +            fDocumentHandler.startDocument(locator, encoding, fNamespaceSupport, augs);
           }
       } // startDocument(XMLLocator,String)
   
  
  
  
  1.36      +25 -3     xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java
  
  Index: XMLDTDValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLDTDValidator.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- XMLDTDValidator.java	24 Sep 2002 09:39:44 -0000	1.35
  +++ XMLDTDValidator.java	24 Sep 2002 23:05:17 -0000	1.36
  @@ -70,11 +70,13 @@
   import org.apache.xerces.impl.dv.DTDDVFactory;
   import org.apache.xerces.impl.dv.InvalidDatatypeValueException;
   
  +import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.XMLSymbols;
   import org.apache.xerces.util.XMLChar;
   
   import org.apache.xerces.xni.Augmentations;
  +import org.apache.xerces.xni.NamespaceContext;
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLString;
   import org.apache.xerces.xni.XMLAttributes;
  @@ -270,6 +272,9 @@
       /* location of the document as passed in from startDocument call */
       protected XMLResourceIdentifier fDocLocation;
   
  +    /** Namespace support. */
  +    protected NamespaceSupport fNamespaceSupport = null;
  +
       /** Datatype validator factory. */
       protected DTDDVFactory fDatatypeValidatorFactory;
   
  @@ -648,11 +653,20 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs   Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs) 
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs) 
       throws XNIException {
   
           // call handlers
  @@ -664,8 +678,16 @@
               }
           }
           fDocLocation = locator;
  +        // REVISIT: in DTD validator we need to be able to update namespace context
  +        //          thus we need to upcast.
  +        if (fNamespaceSupport != null) {
  +            fNamespaceSupport.reset();
  +        }
  +        else {
  +            fNamespaceSupport = new NamespaceSupport();
  +        }
           if (fDocumentHandler != null) {
  -            fDocumentHandler.startDocument(locator, encoding, augs);
  +            fDocumentHandler.startDocument(locator, encoding, fNamespaceSupport, augs);
           }
   
       } // startDocument(XMLLocator,String)
  
  
  
  1.3       +2 -14     xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLNSDTDValidator.java
  
  Index: XMLNSDTDValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dtd/XMLNSDTDValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLNSDTDValidator.java	16 Sep 2002 21:36:40 -0000	1.2
  +++ XMLNSDTDValidator.java	24 Sep 2002 23:05:17 -0000	1.3
  @@ -61,7 +61,6 @@
   import org.apache.xerces.impl.XMLErrorReporter;
   import org.apache.xerces.impl.msg.XMLMessageFormatter;
   
  -import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.XMLSymbols;
   
   import org.apache.xerces.xni.NamespaceContext;
  @@ -105,24 +104,13 @@
   public class XMLNSDTDValidator
                 extends XMLDTDValidator{
   
  -    
  -    /** Namespace support. */
  -    protected NamespaceSupport fNamespaceSupport = null;
  -    
  +        
   
       /** Internal property: namespace context */
       protected static final String NAMESPACE_CONTEXT_PROPERTY =
           Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
       /** Attribute QName. */
       private QName fAttributeQName = new QName();
  -
  -    public void reset(XMLComponentManager componentManager){
  -        super.reset(componentManager);
  -        
  -        // internal xerces property: namespace context 
  -        fNamespaceSupport = (NamespaceSupport)componentManager.getProperty(NAMESPACE_CONTEXT_PROPERTY);
  -    }
  -
   
   
       /** Bind namespaces */
  
  
  
  1.12      +8 -8      xml-xerces/java/src/org/apache/xerces/impl/validation/ValidationState.java
  
  Index: ValidationState.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/ValidationState.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ValidationState.java	18 Jul 2002 20:48:44 -0000	1.11
  +++ ValidationState.java	24 Sep 2002 23:05:17 -0000	1.12
  @@ -57,10 +57,10 @@
   
   package org.apache.xerces.impl.validation;
   
  -import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.impl.dv.ValidationContext;
   
  +import org.apache.xerces.xni.NamespaceContext;
   import java.util.Hashtable;
   import java.util.Enumeration;
   
  @@ -81,7 +81,7 @@
       private boolean fNormalize                  = true;
   
       private EntityState fEntityState            = null;
  -    private NamespaceSupport fNamespaceSupport  = null;
  +    private NamespaceContext fNamespaceContext  = null;
       private SymbolTable fSymbolTable            = null;
   
       //REVISIT: Should replace with a lighter structure.
  @@ -108,8 +108,8 @@
           fEntityState = state;
       }
   
  -    public void setNamespaceSupport(NamespaceSupport namespace) {
  -        fNamespaceSupport = namespace;
  +    public void setNamespaceSupport(NamespaceContext namespace) {
  +        fNamespaceContext = namespace;
       }
   
       public void setSymbolTable(SymbolTable sTable) {
  @@ -139,7 +139,7 @@
           fIdTable.clear();
           fIdRefTable.clear();
           fEntityState = null;
  -        fNamespaceSupport = null;
  +        fNamespaceContext = null;
           fSymbolTable = null;
       }
   
  @@ -211,8 +211,8 @@
       }
       // qname, notation
       public String getURI(String prefix) {
  -        if (fNamespaceSupport !=null) {
  -            return fNamespaceSupport.getURI(prefix);
  +        if (fNamespaceContext !=null) {
  +            return fNamespaceContext.getURI(prefix);
           }
           return null;
       }
  
  
  
  1.106     +18 -13    xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
  
  Index: XMLSchemaValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- XMLSchemaValidator.java	24 Sep 2002 09:39:45 -0000	1.105
  +++ XMLSchemaValidator.java	24 Sep 2002 23:05:18 -0000	1.106
  @@ -78,7 +78,6 @@
   
   
   import org.apache.xerces.util.AugmentationsImpl;
  -import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
   import org.apache.xerces.util.XMLSymbols;
   import org.apache.xerces.util.XMLChar;
  @@ -87,6 +86,7 @@
   import org.apache.xerces.util.XMLAttributesImpl;
   
   import org.apache.xerces.xni.Augmentations;
  +import org.apache.xerces.xni.NamespaceContext;
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLString;
   import org.apache.xerces.xni.XMLAttributes;
  @@ -235,7 +235,7 @@
       /** Feature defaults. */
       private static final Boolean[] FEATURE_DEFAULTS = {
           null,
  -        Boolean.FALSE,
  +        Boolean.TRUE,
           Boolean.FALSE,
           Boolean.FALSE,
       };
  @@ -570,17 +570,30 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs     Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs)
       throws XNIException {
   
  +        fValidationState.setNamespaceSupport(namespaceContext);
  +        fState4XsiType.setNamespaceSupport(namespaceContext);
  +        fState4ApplyDefault.setNamespaceSupport(namespaceContext);
  +
           handleStartDocument(locator, encoding);
           // call handlers
           if (fDocumentHandler != null) {
  -            fDocumentHandler.startDocument(locator, encoding, augs);
  +            fDocumentHandler.startDocument(locator, encoding, namespaceContext, augs);
           }
   
       } // startDocument(XMLLocator,String)
  @@ -1080,9 +1093,6 @@
       // Schema grammar loader
       final XMLSchemaLoader fSchemaLoader;
   
  -    /** Namespace support. */
  -    protected NamespaceSupport fNamespaceSupport = null;
  -    
       /** the DV usd to convert xsi:type to a QName */
       // REVISIT: in new simple type design, make things in DVs static,
       //          so that we can QNameDV.getCompiledForm()
  @@ -1243,11 +1253,6 @@
               fSymbolTable = symbolTable;
           }
   
  -        // internal xerces property: namespace-context 
  -        fNamespaceSupport = (NamespaceSupport)componentManager.getProperty(NAMESPACE_CONTEXT_PROPERTY);
  -        fValidationState.setNamespaceSupport(fNamespaceSupport);
  -        fState4XsiType.setNamespaceSupport(fNamespaceSupport);
  -        fState4ApplyDefault.setNamespaceSupport(fNamespaceSupport);
   
           try {
               fDynamicValidation = componentManager.getFeature(DYNAMIC_VALIDATION);
  
  
  
  1.8       +13 -3     xml-xerces/java/src/org/apache/xerces/impl/xs/dom/DOMParser.java
  
  Index: DOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/dom/DOMParser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMParser.java	16 Sep 2002 21:36:41 -0000	1.7
  +++ DOMParser.java	24 Sep 2002 23:05:18 -0000	1.8
  @@ -63,6 +63,7 @@
   import org.apache.xerces.impl.xs.SchemaSymbols;
   import org.apache.xerces.impl.xs.XSMessageFormatter;
   import org.apache.xerces.xni.XMLLocator;
  +import org.apache.xerces.xni.NamespaceContext;
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.Augmentations;
   import org.apache.xerces.xni.XMLAttributes;
  @@ -143,14 +144,23 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs     Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs)
           throws XNIException {
   
  -        super.startDocument(locator, encoding, augs);
  +        super.startDocument(locator, encoding, namespaceContext, augs);
           // get a handle to the document created
           fDocumentImpl = (DocumentImpl)super.fDocumentImpl;
           fDocumentImpl.fNodePool=fNodePool;
  
  
  
  1.76      +16 -6     xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
  
  Index: AbstractDOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- AbstractDOMParser.java	19 Sep 2002 17:50:40 -0000	1.75
  +++ AbstractDOMParser.java	24 Sep 2002 23:05:18 -0000	1.76
  @@ -127,7 +127,7 @@
    *
    * @version $Id$
    */
  -public class AbstractDOMParser extends AbstractXMLDocumentParser{
  +public class AbstractDOMParser extends AbstractXMLDocumentParser {
   
       //
       // Constants
  @@ -158,7 +158,8 @@
       /** Feature id: defer node expansion. */
       protected static final String DEFER_NODE_EXPANSION =
           Constants.XERCES_FEATURE_PREFIX + Constants.DEFER_NODE_EXPANSION_FEATURE;
  -    
  +
  +
       /** Recognized features. */
       private static final String[] RECOGNIZED_FEATURES = {
           NAMESPACES,
  @@ -166,7 +167,7 @@
           INCLUDE_COMMENTS_FEATURE,
           CREATE_CDATA_NODES_FEATURE,
           INCLUDE_IGNORABLE_WHITESPACE,
  -        DEFER_NODE_EXPANSION,
  +        DEFER_NODE_EXPANSION
       };
   
       // property ids
  @@ -499,13 +500,13 @@
                }
               setCharacterData(true);
               EntityReference er = fDocument.createEntityReference(name);            
  -            
               if (fDocumentImpl != null) {            
                   // REVISIT: baseURI/actualEncoding
                   //         remove dependency on our implementation when DOM L3 is REC
                   //
   
                   EntityReferenceImpl erImpl =(EntityReferenceImpl)er; 
  +
                   // set base uri
                   erImpl.setBaseURI(identifier.getExpandedSystemId());
   
  @@ -732,11 +733,20 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs     Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs)
           throws XNIException {
   
           fInDocument = true;
  
  
  
  1.33      +12 -2     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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- AbstractSAXParser.java	19 Sep 2002 17:50:40 -0000	1.32
  +++ AbstractSAXParser.java	24 Sep 2002 23:05:18 -0000	1.33
  @@ -69,6 +69,7 @@
   import org.apache.xerces.util.EntityResolverWrapper;
   import org.apache.xerces.util.ErrorHandlerWrapper;
   
  +import org.apache.xerces.xni.NamespaceContext;
   import org.apache.xerces.xni.Augmentations;
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLAttributes;
  @@ -247,11 +248,20 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs     Additional information that may include infoset augmentations
        *
        * @throws XNIException Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs)
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs)
           throws XNIException {
   
           try {
  
  
  
  1.14      +12 -2     xml-xerces/java/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java
  
  Index: AbstractXMLDocumentParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractXMLDocumentParser.java	16 Aug 2002 18:08:38 -0000	1.13
  +++ AbstractXMLDocumentParser.java	24 Sep 2002 23:05:18 -0000	1.14
  @@ -60,6 +60,7 @@
   import java.io.IOException;
   
   import org.apache.xerces.xni.Augmentations;
  +import org.apache.xerces.xni.NamespaceContext;
   import org.apache.xerces.xni.QName;
   import org.apache.xerces.xni.XMLAttributes;
   import org.apache.xerces.xni.XMLDocumentHandler;
  @@ -135,12 +136,21 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader). 
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
        * @param augs   Additional information that may include infoset augmentations    
        *     
        * @throws XNIException Thrown by handler to signal an error.
        */
   
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs) 
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext, Augmentations augs) 
           throws XNIException {
       } // startDocument(XMLLocator,String)
   
  
  
  
  1.13      +1 -15     xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java
  
  Index: BasicParserConfiguration.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/BasicParserConfiguration.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- BasicParserConfiguration.java	24 Sep 2002 09:39:45 -0000	1.12
  +++ BasicParserConfiguration.java	24 Sep 2002 23:05:18 -0000	1.13
  @@ -178,10 +178,6 @@
       protected static final String ENTITY_RESOLVER = 
           Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
   
  -    /** Property identifier: namespace context */
  -    protected static final String NAMESPACE_CONTEXT_PROPERTY =
  -        Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
  -
       //
       // Data
       //
  @@ -192,9 +188,6 @@
       protected SymbolTable fSymbolTable;
   
   
  -    /** Read/write namespace context */
  -    protected NamespaceSupport fNamespaceContext;
  -
       // data
   
       /** Locale. */
  @@ -278,7 +271,6 @@
               SYMBOL_TABLE,
               ERROR_HANDLER,  
               ENTITY_RESOLVER,
  -            NAMESPACE_CONTEXT_PROPERTY
           };
           addRecognizedProperties(recognizedProperties);
   
  @@ -288,8 +280,6 @@
           fSymbolTable = symbolTable;
           setProperty(SYMBOL_TABLE, fSymbolTable);
   
  -        fNamespaceContext = new NamespaceSupport();
  -        setProperty(NAMESPACE_CONTEXT_PROPERTY, fNamespaceContext);
       } // <init>(SymbolTable)
   
       /** 
  @@ -495,7 +485,6 @@
               XMLComponent c = (XMLComponent) fComponents.elementAt(i);
               c.setFeature(featureId, state);
           }
  -
           // save state if noone "objects"
           super.setFeature(featureId, state);
   
  @@ -547,9 +536,6 @@
        * reset all components before parsing and namespace context
        */
       protected void reset() throws XNIException {
  -
  -        // reset namespace context before the next parse
  -        fNamespaceContext.reset();
   
           // reset every component
           int count = fComponents.size();
  
  
  
  1.5       +3 -2      xml-xerces/java/src/org/apache/xerces/util/ParserConfigurationSettings.java
  
  Index: ParserConfigurationSettings.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/ParserConfigurationSettings.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParserConfigurationSettings.java	4 Jun 2002 16:53:01 -0000	1.4
  +++ ParserConfigurationSettings.java	24 Sep 2002 23:05:18 -0000	1.5
  @@ -167,13 +167,14 @@
        * @exception org.apache.xerces.xni.parser.XMLConfigurationException If the
        *            requested feature is not known.
        */
  +    static int counter = 1;
       public void setFeature(String featureId, boolean state)
           throws XMLConfigurationException {
   
           // check and store
           checkFeature(featureId);
  -        fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
   
  +        fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE);
       } // setFeature(String,boolean)
   
       /**
  
  
  
  1.8       +2 -2      xml-xerces/java/src/org/apache/xerces/xni/NamespaceContext.java
  
  Index: NamespaceContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/NamespaceContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NamespaceContext.java	14 Aug 2002 17:52:52 -0000	1.7
  +++ NamespaceContext.java	24 Sep 2002 23:05:18 -0000	1.8
  @@ -101,7 +101,7 @@
       public String getURI(String prefix);
   
       /**
  -     * Return a count of all prefixes currently declared, including
  +     * Return a count of locally declared prefixes, including
        * the default prefix if bound.
        */
       public int getDeclaredPrefixCount();
  
  
  
  1.8       +13 -2     xml-xerces/java/src/org/apache/xerces/xni/XMLDocumentHandler.java
  
  Index: XMLDocumentHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/XMLDocumentHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLDocumentHandler.java	16 Aug 2002 18:08:38 -0000	1.7
  +++ XMLDocumentHandler.java	24 Sep 2002 23:05:18 -0000	1.8
  @@ -89,11 +89,22 @@
        *                 where the entity encoding is not auto-detected (e.g.
        *                 internal entities or a document entity that is
        *                 parsed from a java.io.Reader).
  +     * @param namespaceContext
  +     *                 The namespace context in effect at the
  +     *                 start of this document.
  +     *                 This object represents the current context.
  +     *                 Implementors of this class are responsible
  +     *                 for copying the namespace bindings from the
  +     *                 the current context (and its parent contexts)
  +     *                 if that information is important.
  +     *                 
        * @param augs     Additional information that may include infoset augmentations
        * @exception XNIException
        *                   Thrown by handler to signal an error.
        */
  -    public void startDocument(XMLLocator locator, String encoding, Augmentations augs) 
  +    public void startDocument(XMLLocator locator, String encoding, 
  +                              NamespaceContext namespaceContext,
  +                              Augmentations augs) 
           throws XNIException;
   
       /**
  
  
  

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