You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/02/16 00:27:03 UTC

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

lehors      01/02/15 15:27:03

  Modified:    java/src/org/apache/xerces/dom DOMImplementationImpl.java
                        DocumentImpl.java
  Log:
  fixed DOM Level 2 DOMImplementation.createDocument() implementation
  
  Revision  Changes    Path
  1.11      +11 -5     xml-xerces/java/src/org/apache/xerces/dom/DOMImplementationImpl.java
  
  Index: DOMImplementationImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMImplementationImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DOMImplementationImpl.java	2000/11/20 01:54:50	1.10
  +++ DOMImplementationImpl.java	2001/02/15 23:27:01	1.11
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -188,11 +188,17 @@
                                                throws DOMException
       {
       	if (doctype != null && doctype.getOwnerDocument() != null) {
  -    		throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, 
  -    		                           "DOM005 Wrong document");
  +            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, 
  +                                   "DOM005 Wrong document");
           }
  -        DocumentImpl doc = new DocumentImpl(doctype);
  -        //((DocumentTypeImpl)doctype).ownerDocument = doc;
  +        DocumentTypeImpl doctypeImpl;
  +        try {
  +            doctypeImpl = (DocumentTypeImpl) doctype;
  +        } catch (ClassCastException e) {
  +            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, 
  +                                   "DOM005 Wrong document");
  +        }
  +        DocumentImpl doc = new DocumentImpl(doctypeImpl);
           Element e = doc.createElementNS( namespaceURI, qualifiedName);
           doc.appendChild(e);
           return doc;
  
  
  
  1.52      +12 -10    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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- DocumentImpl.java	2001/02/12 23:19:37	1.51
  +++ DocumentImpl.java	2001/02/15 23:27:01	1.52
  @@ -249,7 +249,7 @@
           XMLCharacterProperties.initCharFlags();
       }
   
  -    /** Experimental constructor. */
  +    /** Constructor. */
       public DocumentImpl(boolean grammarAccess) {
           super(null);
           ownerDocument = this;
  @@ -258,21 +258,23 @@
           XMLCharacterProperties.initCharFlags();
       }
   
  -    // For DOM2: support.
  -    // The createDocument factory method is in DOMImplementation.
  -    public DocumentImpl(DocumentType doctype)
  +    /**
  +     * For DOM2 support.
  +     * The createDocument factory method is in DOMImplementation.
  +     */
  +    public DocumentImpl(DocumentTypeImpl doctype)
       {
           this(doctype, false);
           // make sure the XMLCharacterProperties class is initilialized
           XMLCharacterProperties.initCharFlags();
       }
  -    
  -    /** Experimental constructor. */
  -    public DocumentImpl(DocumentType doctype, boolean grammarAccess) {
  +
  +    /** For DOM2 support. */
  +    public DocumentImpl(DocumentTypeImpl doctype, boolean grammarAccess) {
           this(grammarAccess);
  -        this.docType = (DocumentTypeImpl)doctype;
  -        if (this.docType != null) {
  -            docType.ownerDocument = this;
  +        if (doctype != null) {
  +            doctype.ownerDocument = this;
  +            appendChild(doctype);
           }
           // make sure the XMLCharacterProperties class is initilialized
           XMLCharacterProperties.initCharFlags();