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/03/28 22:17:30 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom ASDOMImplementationImpl.java DOMImplementationImpl.java CoreDOMImplementationImpl.java
elena 02/03/28 13:17:30
Modified: java/src/org/apache/xerces/dom DOMImplementationImpl.java
CoreDOMImplementationImpl.java
Added: java/src/org/apache/xerces/dom ASDOMImplementationImpl.java
Log:
Add ASDOMImplementation that implements DOMImplementationAS. CoreDOMImplementation
now also support Load/Save.
Revision Changes Path
1.22 +2 -78 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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- DOMImplementationImpl.java 29 Jan 2002 01:15:07 -0000 1.21
+++ DOMImplementationImpl.java 28 Mar 2002 21:17:30 -0000 1.22
@@ -63,19 +63,6 @@
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
-// DOM L3 LS
-import org.apache.xerces.dom3.ls.DOMImplementationLS;
-import org.apache.xerces.dom3.ls.DOMBuilder;
-import org.apache.xerces.dom3.ls.DOMWriter;
-import org.apache.xerces.dom3.ls.DOMInputSource;
-import org.apache.xerces.dom3.as.DOMImplementationAS;
-import org.apache.xerces.dom3.as.ASModel;
-import org.apache.xerces.dom3.as.DOMASBuilder;
-import org.apache.xerces.dom3.as.DOMASWriter;
-import org.apache.xerces.parsers.DOMBuilderImpl;
-import org.apache.xerces.parsers.DOMASBuilderImpl;
-import org.apache.xml.serialize.XMLSerializer;
-
/**
@@ -87,11 +74,11 @@
* methods. However, there's nothing that says it can't be a singleton,
* so that's how I've implemented it.
*
- * @version $Id: DOMImplementationImpl.java,v 1.21 2002/01/29 01:15:07 lehors Exp $
+ * @version $Id: DOMImplementationImpl.java,v 1.22 2002/03/28 21:17:30 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class DOMImplementationImpl
- implements DOMImplementation, DOMImplementationLS, DOMImplementationAS {
+ implements DOMImplementation {
//
// Data
@@ -221,68 +208,5 @@
return doc;
}
- // DOM L3 LS
- /**
- * DOM Level 3 WD - Experimental.
- */
- public DOMBuilder createDOMBuilder(short mode)
- throws DOMException {
- if (mode == DOMImplementationLS.MODE_ASYNCHRONOUS) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
- "Asynchronous mode is not supported");
- }
- return new DOMBuilderImpl();
- }
- /**
- * DOM Level 3 WD - Experimental.
- */
- public DOMWriter createDOMWriter() {
- return new XMLSerializer();
- }
- /**
- * DOM Level 3 WD - Experimental.
- */
- public DOMInputSource createDOMInputSource() {
- return new DOMInputSourceImpl();
- }
-
- //
- // DOM L3 Abstract Schemas
- //
-
- /**
- * DOM Level 3 WD - Experimental.
- * Creates an ASModel.
- * @param isNamespaceAware Allow creation of <code>ASModel</code> with
- * this attribute set to a specific value.
- * @return A <code>null</code> return indicates failure.what is a
- * failure? Could be a system error.
- */
- public ASModel createAS(boolean isNamespaceAware){
- return new ASModelImpl(isNamespaceAware);
- }
-
- /**
- * DOM Level 3 WD - Experimental.
- * Creates an <code>DOMASBuilder</code>.Do we need the method since we
- * already have <code>DOMImplementationLS.createDOMBuilder</code>?
- * @return DOMASBuilder
- */
- public DOMASBuilder createDOMASBuilder(){
- return new DOMASBuilderImpl();
- }
-
-
- /**
- * DOM Level 3 WD - Experimental.
- * Creates an <code>DOMASWriter</code>.
- * @return a DOMASWriter
- */
- public DOMASWriter createDOMASWriter(){
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
- "ASWriter is not implemented.");
- }
-
-
} // class DOMImplementationImpl
1.5 +63 -26 xml-xerces/java/src/org/apache/xerces/dom/CoreDOMImplementationImpl.java
Index: CoreDOMImplementationImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDOMImplementationImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CoreDOMImplementationImpl.java 29 Jan 2002 01:15:07 -0000 1.4
+++ CoreDOMImplementationImpl.java 28 Mar 2002 21:17:30 -0000 1.5
@@ -63,6 +63,15 @@
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
+
+// DOM L3 LS
+import org.apache.xerces.dom3.ls.DOMImplementationLS;
+import org.apache.xerces.dom3.ls.DOMBuilder;
+import org.apache.xerces.dom3.ls.DOMWriter;
+import org.apache.xerces.dom3.ls.DOMInputSource;
+import org.apache.xerces.parsers.DOMBuilderImpl;
+import org.apache.xml.serialize.XMLSerializer;
+
/**
* The DOMImplementation class is description of a particular
* implementation of the Document Object Model. As such its data is
@@ -72,15 +81,14 @@
* methods. However, there's nothing that says it can't be a singleton,
* so that's how I've implemented it.
* <P>
- * This particular class, along with CoreDocumentImpl, only supports the DOM
- * Core. Optional modules are supported by the more complete DOMImplementation
- * class along with DocumentImpl.
- *
- * @version $Id: CoreDOMImplementationImpl.java,v 1.4 2002/01/29 01:15:07 lehors Exp $
- * @since PR-DOM-Level-1-19980818.
+ * This particular class, along with CoreDocumentImpl, supports the DOM
+ * Core and Load/Save (Experimental). Optional modules are supported by
+ * the more complete DOMImplementation class along with DocumentImpl.
+ * @version $Id: CoreDOMImplementationImpl.java,v 1.5 2002/03/28 21:17:30 elena Exp $
+ * @since PR-DOM-Level-1-19980818.
*/
public class CoreDOMImplementationImpl
- implements DOMImplementation {
+implements DOMImplementation, DOMImplementationLS {
//
// Data
@@ -90,7 +98,7 @@
/** Dom implementation singleton. */
static CoreDOMImplementationImpl singleton =
- new CoreDOMImplementationImpl();
+ new CoreDOMImplementationImpl();
//
// DOMImplementation methods
@@ -116,15 +124,18 @@
// Currently, we support only XML Level 1 version 1.0
boolean anyVersion = version == null || version.length() == 0;
return
- (feature.equalsIgnoreCase("Core")
+ (feature.equalsIgnoreCase("Core")
+ && (anyVersion
+ || version.equals("1.0")
+ || version.equals("2.0")))
+ || (feature.equalsIgnoreCase("XML")
&& (anyVersion
- || version.equals("1.0")
- || version.equals("2.0")))
- || (feature.equalsIgnoreCase("XML")
- && (anyVersion
- || version.equals("1.0")
- || version.equals("2.0")))
- ;
+ || version.equals("1.0")
+ || version.equals("2.0")))
+ /* || (feature.equalsIgnoreCase("LS-Load")
+ && version.equals("3.0");
+ */
+ ;
} // hasFeature(String,String):boolean
@@ -136,7 +147,7 @@
public static DOMImplementation getDOMImplementation() {
return singleton;
}
-
+
/**
* Introduced in DOM Level 2. <p>
*
@@ -151,18 +162,18 @@
String publicID,
String systemID)
{
- if (!CoreDocumentImpl.isXMLName(qualifiedName)) {
- throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
- "DOM002 Illegal character");
+ if (!CoreDocumentImpl.isXMLName(qualifiedName)) {
+ throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
+ "DOM002 Illegal character");
}
int index = qualifiedName.indexOf(':');
int lastIndex = qualifiedName.lastIndexOf(':');
// it is an error for NCName to have more than one ':'
if (index == 0 || index == qualifiedName.length() - 1 || lastIndex!=index) {
- throw new DOMException(DOMException.NAMESPACE_ERR,
- "DOM003 Namespace error");
- }
- return new DocumentTypeImpl(null, qualifiedName, publicID, systemID);
+ throw new DOMException(DOMException.NAMESPACE_ERR,
+ "DOM003 Namespace error");
+ }
+ return new DocumentTypeImpl(null, qualifiedName, publicID, systemID);
}
/**
* Introduced in DOM Level 2. <p>
@@ -187,9 +198,9 @@
public Document createDocument(String namespaceURI,
String qualifiedName,
DocumentType doctype)
- throws DOMException
+ throws DOMException
{
- if (doctype != null && doctype.getOwnerDocument() != null) {
+ if (doctype != null && doctype.getOwnerDocument() != null) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
"DOM005 Wrong document");
}
@@ -198,5 +209,31 @@
doc.appendChild(e);
return doc;
}
+
+ // DOM L3 LS
+ /**
+ * DOM Level 3 WD - Experimental.
+ */
+ public DOMBuilder createDOMBuilder(short mode)
+ throws DOMException {
+ if (mode == DOMImplementationLS.MODE_ASYNCHRONOUS) {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
+ "Asynchronous mode is not supported");
+ }
+ return new DOMBuilderImpl();
+ }
+ /**
+ * DOM Level 3 WD - Experimental.
+ */
+ public DOMWriter createDOMWriter() {
+ return new XMLSerializer();
+ }
+ /**
+ * DOM Level 3 WD - Experimental.
+ */
+ public DOMInputSource createDOMInputSource() {
+ return new DOMInputSourceImpl();
+ }
+
} // class DOMImplementationImpl
1.1 xml-xerces/java/src/org/apache/xerces/dom/ASDOMImplementationImpl.java
Index: ASDOMImplementationImpl.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xerces.dom;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.apache.xerces.dom3.as.DOMImplementationAS;
import org.apache.xerces.dom3.as.ASModel;
import org.apache.xerces.dom3.as.DOMASBuilder;
import org.apache.xerces.dom3.as.DOMASWriter;
import org.apache.xerces.parsers.DOMASBuilderImpl;
/**
* The DOMImplementation class is description of a particular
* implementation of the Document Object Model. As such its data is
* static, shared by all instances of this implementation.
* <P>
* The DOM API requires that it be a real object rather than static
* methods. However, there's nothing that says it can't be a singleton,
* so that's how I've implemented it.
* <P>
* This particular class, along with DocumentImpl, supports the DOM
* Core, DOM Level 2 optional mofules, and Abstract Schemas (Experimental).
* @version $Id: ASDOMImplementationImpl.java,v 1.1 2002/03/28 21:17:30 elena Exp $
* @since PR-DOM-Level-1-19980818.
*/
public class ASDOMImplementationImpl extends DOMImplementationImpl
implements DOMImplementationAS {
//
// DOM L3 Abstract Schemas:
// REVISIT: implement hasFeature()
//
/**
* DOM Level 3 WD - Experimental.
* Creates an ASModel.
* @param isNamespaceAware Allow creation of <code>ASModel</code> with
* this attribute set to a specific value.
* @return A <code>null</code> return indicates failure.what is a
* failure? Could be a system error.
*/
public ASModel createAS(boolean isNamespaceAware){
return new ASModelImpl(isNamespaceAware);
}
/**
* DOM Level 3 WD - Experimental.
* Creates an <code>DOMASBuilder</code>.Do we need the method since we
* already have <code>DOMImplementationLS.createDOMBuilder</code>?
* @return DOMASBuilder
*/
public DOMASBuilder createDOMASBuilder(){
return new DOMASBuilderImpl();
}
/**
* DOM Level 3 WD - Experimental.
* Creates an <code>DOMASWriter</code>.
* @return a DOMASWriter
*/
public DOMASWriter createDOMASWriter(){
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"ASWriter is not implemented.");
}
} // class DOMImplementationImpl
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org