286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 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 java.io.IOException;
286N/Aimport java.io.NotSerializableException;
286N/Aimport java.io.ObjectInputStream;
286N/Aimport java.io.ObjectOutputStream;
286N/Aimport org.w3c.dom.DOMConfiguration;
286N/Aimport org.w3c.dom.UserDataHandler;
286N/Aimport org.w3c.dom.*;
286N/A
286N/A/**
286N/A * Our own document implementation, which knows how to create an element
286N/A * with PSVI information.
286N/A *
286N/A * @xerces.internal
286N/A *
286N/A * @author Sandy Gao, IBM
286N/A *
286N/A */
286N/Apublic class PSVIDocumentImpl extends DocumentImpl {
286N/A
286N/A /** Serialization version. */
286N/A static final long serialVersionUID = -8822220250676434522L;
286N/A
286N/A /**
286N/A * Create a document.
286N/A */
286N/A public PSVIDocumentImpl() {
286N/A super();
286N/A }
286N/A
286N/A /**
286N/A * For DOM2 support.
286N/A * The createDocument factory method is in DOMImplementation.
286N/A */
286N/A public PSVIDocumentImpl(DocumentType doctype) {
286N/A super(doctype);
286N/A }
286N/A
286N/A /**
286N/A * Deep-clone a document, including fixing ownerDoc for the cloned
286N/A * children. Note that this requires bypassing the WRONG_DOCUMENT_ERR
286N/A * protection. I've chosen to implement it by calling importNode
286N/A * which is DOM Level 2.
286N/A *
286N/A * @return org.w3c.dom.Node
286N/A * @param deep boolean, iff true replicate children
286N/A */
286N/A public Node cloneNode(boolean deep) {
286N/A
286N/A PSVIDocumentImpl newdoc = new PSVIDocumentImpl();
286N/A callUserDataHandlers(this, newdoc, UserDataHandler.NODE_CLONED);
286N/A cloneNode(newdoc, deep);
286N/A
286N/A // experimental
286N/A newdoc.mutationEvents = mutationEvents;
286N/A
286N/A return newdoc;
286N/A
286N/A } // cloneNode(boolean):Node
286N/A
286N/A /**
286N/A * Retrieve information describing the abilities of this particular
286N/A * DOM implementation. Intended to support applications that may be
286N/A * using DOMs retrieved from several different sources, potentially
286N/A * with different underlying representations.
286N/A */
286N/A public DOMImplementation getImplementation() {
286N/A // Currently implemented as a singleton, since it's hardcoded
286N/A // information anyway.
286N/A return PSVIDOMImplementationImpl.getDOMImplementation();
286N/A }
286N/A
286N/A /**
286N/A * Create an element with PSVI information
286N/A */
286N/A public Element createElementNS(String namespaceURI, String qualifiedName)
286N/A throws DOMException {
286N/A return new PSVIElementNSImpl(this, namespaceURI, qualifiedName);
286N/A }
286N/A
286N/A /**
286N/A * Create an element with PSVI information
286N/A */
286N/A public Element createElementNS(String namespaceURI, String qualifiedName,
286N/A String localpart) throws DOMException {
286N/A return new PSVIElementNSImpl(this, namespaceURI, qualifiedName, localpart);
286N/A }
286N/A
286N/A /**
286N/A * Create an attribute with PSVI information
286N/A */
286N/A public Attr createAttributeNS(String namespaceURI, String qualifiedName)
286N/A throws DOMException {
286N/A return new PSVIAttrNSImpl(this, namespaceURI, qualifiedName);
286N/A }
286N/A
286N/A /**
286N/A * Create an attribute with PSVI information
286N/A */
286N/A public Attr createAttributeNS(String namespaceURI, String qualifiedName,
286N/A String localName) throws DOMException {
286N/A return new PSVIAttrNSImpl(this, namespaceURI, qualifiedName, localName);
286N/A }
286N/A
286N/A /**
286N/A *
286N/A * The configuration used when <code>Document.normalizeDocument</code> is
286N/A * invoked.
286N/A * @since DOM Level 3
286N/A */
286N/A public DOMConfiguration getDomConfig(){
286N/A super.getDomConfig();
286N/A return fConfiguration;
286N/A }
286N/A
286N/A // REVISIT: Forbid serialization of PSVI DOM until
286N/A // we support object serialization of grammars -- mrglavas
286N/A
286N/A private void writeObject(ObjectOutputStream out)
286N/A throws IOException {
286N/A throw new NotSerializableException(getClass().getName());
286N/A }
286N/A
286N/A private void readObject(ObjectInputStream in)
286N/A throws IOException, ClassNotFoundException {
286N/A throw new NotSerializableException(getClass().getName());
286N/A }
286N/A
286N/A} // class PSVIDocumentImpl