elena       2003/01/07 12:59:52

  Modified:    java/src/org/apache/xerces/dom CoreDocumentImpl.java
                        DOMNormalizer.java
  Log:
  Update Id table during normalizeDocument operation
  
  Revision  Changes    Path
  1.38      +10 -1     xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
  
  Index: CoreDocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- CoreDocumentImpl.java     31 Dec 2002 01:16:06 -0000      1.37
  +++ CoreDocumentImpl.java     7 Jan 2003 20:59:52 -0000       1.38
  @@ -1596,6 +1596,15 @@
           return getIdentifier(elementId);
       }
   
  +     /**
  +      * Remove all identifiers from the ID table
  +      */
  +    protected final void clearIdentifiers (){
  +        if (identifiers != null){
  +            identifiers.clear();
  +        }
  +    }
  +
       /**
        * Registers an identifier name with a specified element node.
        * If the identifier is already registered, the new element
  
  
  
  1.23      +33 -5     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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DOMNormalizer.java        31 Dec 2002 01:55:05 -0000      1.22
  +++ DOMNormalizer.java        7 Jan 2003 20:59:52 -0000       1.23
  @@ -64,6 +64,8 @@
   import org.apache.xerces.dom3.DOMErrorHandler;
   import org.apache.xerces.impl.Constants;
   import org.apache.xerces.impl.RevalidationHandler;
  +import org.apache.xerces.impl.dv.XSSimpleType;
  +import org.apache.xerces.impl.xs.psvi.XSTypeDefinition;
   import org.apache.xerces.util.AugmentationsImpl;
   import org.apache.xerces.util.NamespaceSupport;
   import org.apache.xerces.util.SymbolTable;
  @@ -218,8 +220,12 @@
               
                        // check if we need to fill in PSVI
               fPSVI = ((fConfiguration.features & DOMConfigurationImpl.PSVI) 
!=0)?true:false;
  -                     // REVISIT: pass namespace context to the XML Schema validator
  -                      ((XMLComponent) fValidationHandler).reset(fConfiguration);
  +            
  +            // reset ID table           
  +            fDocument.clearIdentifiers();
  +            
  +            // reset schema validator
  +                     ((XMLComponent) fValidationHandler).reset(fConfiguration);
                }
   
                fErrorHandler = (DOMErrorHandler) 
fConfiguration.getParameter("error-handler");
  @@ -739,6 +745,9 @@
                       */
                       // XML 1.0 Attribute value normalization
                       value = normalizeAttributeValue(value, attr);
  +                    
  +                    // reset id-attributes
  +                    ((AttrImpl)attr).setIdAttribute(false);
   
   
                       uri = fSymbolTable.addSymbol(uri);
  @@ -793,6 +802,9 @@
                       int colon = name.indexOf(':');
                       // XML 1.0 Attribute value normalization
                       value = normalizeAttributeValue(value, attr);
  +                    // reset id-attributes
  +                    ((AttrImpl)attr).setIdAttribute(false);
  +
                       if (colon > -1) {
                           // It is an error if document has DOM L1 nodes.
                           boolean continueProcess = true;
  @@ -1067,7 +1079,7 @@
           }
   
   
  -        public void setType(int attrIndex, String attrType){            
  +        public void setType(int attrIndex, String attrType){
               // REVISIT: implement
           }
   
  @@ -1292,10 +1304,26 @@
                        Attr attr = null;
   
                        attr = currentElement.getAttributeNodeNS(fAttrQName.uri, 
fAttrQName.localpart);
  -                     AttributePSVI attrPSVI =
  +            AttributePSVI attrPSVI =
                                (AttributePSVI) 
attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
   
                        if (attrPSVI != null) {
  +                //REVISIT: instead we should be using augmentations:
  +                // to set/retrieve Id attributes
  +                XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition();
  +                boolean id = false;
  +                if (decl != null){
  +                    id = ((XSSimpleType)decl).isIDType();
  +                } else{
  +                    decl = attrPSVI.getTypeDefinition();
  +                    if (decl !=null){
  +                       id = ((XSSimpleType)decl).isIDType(); 
  +                    }
  +                }
  +                if (id){
  +                    ((ElementImpl)currentElement).setIdAttributeNode(attr);
  +                }
  +                
                                if (fPSVI) {
                                        ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI);
                                }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to