286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 1999-2002,2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.dom;
286N/A
286N/Aimport org.w3c.dom.DOMException;
286N/Aimport org.w3c.dom.DOMImplementation;
286N/Aimport org.w3c.dom.Document;
286N/Aimport org.w3c.dom.DocumentType;
286N/Aimport org.w3c.dom.Element;
286N/A
286N/A/**
286N/A * The DOMImplementation class is description of a particular
286N/A * implementation of the Document Object Model. As such its data is
286N/A * static, shared by all instances of this implementation.
286N/A * <P>
286N/A * The DOM API requires that it be a real object rather than static
286N/A * methods. However, there's nothing that says it can't be a singleton,
286N/A * so that's how I've implemented it.
286N/A *
286N/A * @xerces.internal
286N/A *
286N/A * @since PR-DOM-Level-1-19980818.
286N/A */
286N/Apublic class PSVIDOMImplementationImpl extends CoreDOMImplementationImpl {
286N/A
286N/A //
286N/A // Data
286N/A //
286N/A
286N/A // static
286N/A
286N/A /** Dom implementation singleton. */
286N/A static PSVIDOMImplementationImpl singleton = new PSVIDOMImplementationImpl();
286N/A
286N/A //
286N/A // Public methods
286N/A //
286N/A
286N/A /** NON-DOM: Obtain and return the single shared object */
286N/A public static DOMImplementation getDOMImplementation() {
286N/A return singleton;
286N/A }
286N/A
286N/A //
286N/A // DOMImplementation methods
286N/A //
286N/A
286N/A /**
286N/A * Test if the DOM implementation supports a specific "feature" --
286N/A * currently meaning language and level thereof.
286N/A *
286N/A * @param feature The package name of the feature to test.
286N/A * In Level 1, supported values are "HTML" and "XML" (case-insensitive).
286N/A * At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
286N/A *
286N/A * @param version The version number of the feature being tested.
286N/A * This is interpreted as "Version of the DOM API supported for the
286N/A * specified Feature", and in Level 1 should be "1.0"
286N/A *
286N/A * @return true iff this implementation is compatable with the specified
286N/A * feature and version.
286N/A */
286N/A public boolean hasFeature(String feature, String version) {
286N/A return super.hasFeature(feature, version) ||
286N/A feature.equalsIgnoreCase("psvi");
286N/A } // hasFeature(String,String):boolean
286N/A
286N/A /**
286N/A * Introduced in DOM Level 2. <p>
286N/A *
286N/A * Creates an XML Document object of the specified type with its document
286N/A * element.
286N/A *
286N/A * @param namespaceURI The namespace URI of the document
286N/A * element to create, or null.
286N/A * @param qualifiedName The qualified name of the document
286N/A * element to create.
286N/A * @param doctype The type of document to be created or null.<p>
286N/A *
286N/A * When doctype is not null, its
286N/A * Node.ownerDocument attribute is set to
286N/A * the document being created.
286N/A * @return Document A new Document object.
286N/A * @throws DOMException WRONG_DOCUMENT_ERR: Raised if doctype has
286N/A * already been used with a different document.
286N/A * @since WD-DOM-Level-2-19990923
286N/A */
286N/A public Document createDocument(String namespaceURI,
286N/A String qualifiedName,
286N/A DocumentType doctype)
286N/A throws DOMException
286N/A {
286N/A if (doctype != null && doctype.getOwnerDocument() != null) {
286N/A throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
286N/A DOMMessageFormatter.formatMessage(
286N/A DOMMessageFormatter.XML_DOMAIN,
286N/A "WRONG_DOCUMENT_ERR", null));
286N/A }
286N/A DocumentImpl doc = new PSVIDocumentImpl(doctype);
286N/A Element e = doc.createElementNS( namespaceURI, qualifiedName);
286N/A doc.appendChild(e);
286N/A return doc;
286N/A }
286N/A
286N/A
286N/A} // class DOMImplementationImpl