xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/dom DeferredDocumentImpl.java DeferredEntityImpl.java DocumentImpl.java EntityImpl.java
Date Thu, 01 Feb 2001 16:04:46 GMT
elena       01/02/01 08:04:45

  Modified:    java/src/org/apache/xerces/dom DeferredDocumentImpl.java
                        DeferredEntityImpl.java DocumentImpl.java
                        EntityImpl.java
  Log:
  Implemented some DOM Level 3 features.
  Note: This implementation is experimental. DOM Level 3 is is in working
  draft stage: it is still possible that changes in the specification occur.
  
  Added features are:
  
  EntityImpl
  
  *encoding of type DOMString
  An attribute specifying, as part of the text declaration, the encoding of
   this entity, when it is an external parsed entity. This is null otherwise.
  
  *version of type DOMString
  An attribute specifying, as part of the text declaration, the version number
   of this entity, when it is an external parsed entity. This is null otherwise.
  
  - getEncoding(), getVersion(), setEncoding(), setVersion()
  
  DocumentImpl:
  
  *encoding of type DOMString
  An attribute specifying, as part of the XML declaration, the encoding of
   this document. This is null when unspecified.
  
  *standalone of type boolean
  An attribute specifying, as part of the XML declaration, whether this
  document is standalone.
  
  *version of type DOMString
  An attribute specifying, as part of the XML declaration, the version
   number of this document. This is null when unspecified.
  
  - getEncoding(), getVersion(), setEncoding(), setVersion(), getStandalone(), setStandalone()
  
  Revision  Changes    Path
  1.22      +22 -3     xml-xerces/java/src/org/apache/xerces/dom/DeferredDocumentImpl.java
  
  Index: DeferredDocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredDocumentImpl.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DeferredDocumentImpl.java	2000/12/12 03:23:10	1.21
  +++ DeferredDocumentImpl.java	2001/02/01 16:04:36	1.22
  @@ -276,7 +276,6 @@
   
       /** Creates an entity in the table. */
       public int createEntity(int entityName, int publicId, int systemId, int notationName)
throws Exception {
  -
           // create node
           int nodeIndex = createNode(Node.ENTITY_NODE);
           int chunk     = nodeIndex >> CHUNK_SHIFT;
  @@ -287,17 +286,37 @@
           int echunk = extraDataIndex >> CHUNK_SHIFT;
           int eindex = extraDataIndex & CHUNK_MASK;
   
  +        // create extra data node DOM Level 3 - el
  +        int extraDataIndex2 = createNode((short)0); // node type unimportant
  +        int echunk2 = extraDataIndex2 >> CHUNK_SHIFT;
  +        int eindex2 = extraDataIndex2 & CHUNK_MASK;
  +
           // save name, public id, system id, and notation name
           setChunkIndex(fNodeName, entityName, chunk, index);
           setChunkIndex(fNodeValue, extraDataIndex, chunk, index);
  -        setChunkIndex(fNodeName, publicId, echunk, eindex);
  -        setChunkIndex(fNodeValue, systemId, echunk, eindex);
           setChunkIndex(fNodeLastChild, notationName, echunk, eindex);
  +        setChunkIndex(fNodeName, publicId, echunk, eindex);
  +        setChunkIndex(fNodeValue, extraDataIndex2, echunk, eindex);
  +        setChunkIndex(fNodeName, systemId, echunk2, eindex2);
  +
  +        // initialize encoding and verison for DOM Level 3 - el
  +        setChunkIndex(fNodeValue, -1, echunk2, eindex2);
  +        setChunkIndex(fNodeLastChild, -1, echunk2, eindex2);
   
           // return node index
           return nodeIndex;
   
       } // createEntity(int,int,int,int):int
  +
  +    // DOM Level 3 - el
  +    // setting encoding and version
  +    public void setEntityInfo(int currentEntityDecl, int versionIndex, int encodingIndex){
  +        int eNodeIndex = getNodeValue(getNodeValue(currentEntityDecl, false), false); 
  +        int echunk = eNodeIndex >> CHUNK_SHIFT;
  +        int eindex = eNodeIndex & CHUNK_MASK;
  +        setChunkIndex(fNodeValue, versionIndex, echunk, eindex);
  +        setChunkIndex(fNodeLastChild, encodingIndex, echunk, eindex);
  +    }
   
       /** Creates an entity reference node in the table. */
       public int createEntityReference(int nameIndex) throws Exception {
  
  
  
  1.8       +6 -1      xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityImpl.java
  
  Index: DeferredEntityImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredEntityImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeferredEntityImpl.java	2000/07/07 00:36:10	1.7
  +++ DeferredEntityImpl.java	2001/02/01 16:04:38	1.8
  @@ -161,9 +161,14 @@
           int extraDataIndex = ownerDocument.getNodeValue(fNodeIndex);
           ownerDocument.getNodeType(extraDataIndex);
           publicId     = pool.toString(ownerDocument.getNodeName(extraDataIndex));
  -        systemId     = pool.toString(ownerDocument.getNodeValue(extraDataIndex));
           notationName = pool.toString(ownerDocument.getLastChild(extraDataIndex));
   
  +        // DOM Level 3 adding experimental features -el
  +        extraDataIndex = ownerDocument.getNodeValue(extraDataIndex);
  +        systemId    = pool.toString(ownerDocument.getNodeName(extraDataIndex));
  +        version     = pool.toString(ownerDocument.getNodeValue(extraDataIndex));
  +        encoding    = pool.toString(ownerDocument.getLastChild(extraDataIndex));
  +         
       } // synchronizeData()
   
       /** Synchronize the children. */
  
  
  
  1.46      +78 -0     xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java
  
  Index: DocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- DocumentImpl.java	2001/01/26 19:20:18	1.45
  +++ DocumentImpl.java	2001/02/01 16:04:39	1.46
  @@ -121,6 +121,17 @@
       /** Document element. */
       protected ElementImpl docElement;
   
  +    
  +    /**Experimental DOM Level 3 feature: Document encoding */
  +    protected String encoding;
  +
  +    /**Experimental DOM Level 3 feature: Document version */
  +    protected String version;
  +
  +    /**Experimental DOM Level 3 feature: Document standalone */
  +    protected boolean standalone;
  +
  +
       /** Identifiers. */
       protected Hashtable identifiers;
   
  @@ -564,6 +575,43 @@
   	    return docType;
       }
   
  +
  +   /**
  +    * DOM Level 3 WD - Experimental.      
  +    * The encoding of this document (part of XML Declaration)     
  +    */
  +    public String getEncoding() {
  +        if (needsSyncChildren()) {
  +            synchronizeChildren();
  +        }
  +	    return encoding;
  +
  +    }
  +
  +    /**
  +      * DOM Level 3 WD - Experimental.
  +      * The version of this document (part of XML Declaration)     
  +      */
  +    public String getVersion() {
  +        if (needsSyncChildren()) {
  +            synchronizeChildren();
  +        }
  +	    return version;
  +
  +    }
  +     /**
  +      * DOM Level 3 WD - Experimental.    
  +      * standalone that specifies whether this document is standalone (part of XML Declaration)
    
  +      */
  +    public boolean getStandalone() {
  +        if (needsSyncChildren()) {
  +            synchronizeChildren();
  +        }
  +	    return standalone;
  +
  +    }
  +
  +
       /**
        * Convenience method, allowing direct access to the child node
   	 * which is considered the root of the actual document content. For
  @@ -629,9 +677,39 @@
        * <li>Checks related to DOM events
        * </ul>
        */
  +    
       public void setErrorChecking(boolean check) {
           errorChecking = check;
       }
  +
  +    
  +    /**
  +      * DOM Level 3 WD - Experimental.
  +      * An attribute specifying, as part of the XML declaration, 
  +      * the encoding of this document. This is null when unspecified.
  +      */
  +    public void setEncoding(String value) {
  +        encoding = value;
  +    }
  +
  +    /**
  +      * DOM Level 3 WD - Experimental.
  +      * version - An attribute specifying, as part of the XML declaration, 
  +      * the version number of this document. This is null when unspecified
  +      */
  +    public void setVersion(String value) {
  +       version = value;    
  +    }
  +
  +    /**
  +      * DOM Level 3 WD - Experimental.
  +      * standalone - An attribute specifying, as part of the XML declaration, 
  +      * whether this document is standalone
  +      */
  +    public void setStandalone(boolean value) {
  +        standalone = value;
  +    } 
  +    
   
       /**
        * Returns true if the DOM implementation performs error checking.
  
  
  
  1.11      +74 -4     xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java
  
  Index: EntityImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/EntityImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EntityImpl.java	2000/07/07 00:36:13	1.10
  +++ EntityImpl.java	2001/02/01 16:04:40	1.11
  @@ -117,6 +117,13 @@
       /** System identifier. */
       protected String systemId;
   
  +    /** Encoding */
  +    protected String encoding;
  +
  +    /** Version */
  +    protected String version;
  +
  +
       /** Notation name. */
       protected String notationName;
   
  @@ -190,6 +197,37 @@
       } // getSystemId():String
   
       /** 
  +      * DOM Level 3 WD - experimental
  +      * the version number of this entity, when it is an external parsed entity. 
  +      */
  +    public String getVersion() {
  +
  +       if (needsSyncData()) {
  +           synchronizeData();
  +       }
  +       return version;
  +
  +   } // getVersion():String
  +
  +
  +    /**
  +     * DOM Level 3 WD - experimental 
  +     * the encoding of this entity, when it is an external parsed entity. 
  +     */
  +    public String getEncoding() {
  +
  +       if (needsSyncData()) {
  +           synchronizeData();
  +       }
  +       return encoding;
  +
  +   } // getVersion():String
  +
  +
  +
  +
  +
  +    /** 
        * Unparsed entities -- which contain non-XML data -- have a
        * "notation name" which tells applications how to deal with them.
        * Parsed entities, which <em>are</em> in XML format, don't need this and
  @@ -209,7 +247,7 @@
       //
   
       /**
  -     * NON-DOM The public identifier associated with the entity. If not specified,
  +     * DOM Level 2: The public identifier associated with the entity. If not specified,
        * this will be null. */
       public void setPublicId(String id) {
           
  @@ -217,11 +255,43 @@
               synchronizeData();
           }
       	publicId = id;
  +
  +    } // setPublicId(String)
  +
  +    /**
  +     * DOM Level 3 WD - experimental 
  +     * encoding - An attribute specifying, as part of the text declaration, 
  +     * the encoding of this entity, when it is an external parsed entity. 
  +     * This is null otherwise
  +     */
  +    public void setEncoding(String value) {
  +        
  +        if (needsSyncData()) {
  +            synchronizeData();
  +        }
  +    	encoding = value;
  +
  +    } // setEncoding (String)
  +
  +
  +    /** 
  +      * DOM Level 3 WD - experimental
  +      * version - An attribute specifying, as part of the text declaration, 
  +      * the version number of this entity, when it is an external parsed entity. 
  +      * This is null otherwise
  +      */
  +    public void setVersion(String value) {
  +        
  +        if (needsSyncData()) {
  +            synchronizeData();
  +        }
  +    	version = value;
  +
  +    } // setVersion (String)
   
  -    } // getPublicId(String)
   
       /**
  -     * NON-DOM The system identifier associated with the entity. If not
  +     * DOM Level 2: The system identifier associated with the entity. If not
        * specified, this will be null. 
        */
       public void setSystemId(String id) {
  @@ -234,7 +304,7 @@
       } // setSystemId(String)
   
       /** 
  -     * NON-DOM Unparsed entities -- which contain non-XML data -- have a
  +     * DOM Level 2: Unparsed entities -- which contain non-XML data -- have a
        * "notation name" which tells applications how to deal with them.
        * Parsed entities, which <em>are</em> in XML format, don't need this and
        * set it to null.  
  
  
  

Mime
View raw message