You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by lm...@apache.org on 2003/03/25 21:50:37 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/dom DocumentTypeImpl.java

lmartin     2003/03/25 12:50:37

  Modified:    java/src/org/apache/xerces/dom DocumentTypeImpl.java
  Log:
  added support for ordering disconnected nodes - needed for compareDocumentPosition
  
  Revision  Changes    Path
  1.24      +26 -1     xml-xerces/java/src/org/apache/xerces/dom/DocumentTypeImpl.java
  
  Index: DocumentTypeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DocumentTypeImpl.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DocumentTypeImpl.java	22 Feb 2002 15:12:12 -0000	1.23
  +++ DocumentTypeImpl.java	25 Mar 2003 20:50:37 -0000	1.24
  @@ -123,6 +123,12 @@
       // DOM2: support internal subset.
       protected String internalSubset;
   
  +    /** The following are required for compareDocumentPosition 
  +    */
  +    // Doctype number.   Doc types which have no owner may be assigned 
  +    // a number, on demand, for ordering purposes for compareDocumentPosition
  +    private int doctypeNumber=0;
  +
       //
       // Constructors
       //
  @@ -266,6 +272,25 @@
           entities.setOwnerDocument(doc);
           notations.setOwnerDocument(doc);
           elements.setOwnerDocument(doc);
  +    }
  +
  +    /** NON-DOM  
  +        Get the number associated with this doctype.    
  +    */
  +    protected int getNodeNumber() {
  +         // If the doctype has a document owner, get the node number 
  +         // relative to the owner doc
  +         if (getOwnerDocument()!=null) 
  +            return super.getNodeNumber();
  +
  +         // The doctype is disconnected and not associated with any document.
  +         // Assign the doctype a number relative to the implementation.
  +         if (doctypeNumber==0) {
  +          
  +            CoreDOMImplementationImpl cd = (CoreDOMImplementationImpl)CoreDOMImplementationImpl.getDOMImplementation();
  +            doctypeNumber = cd.assignDocTypeNumber();   
  +         }
  +         return doctypeNumber;
       }
   
       //
  
  
  

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