001 /* 002 * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 /* $Id: JEuclidDOMImplementation.java,v 88b901bf20fb 2008/06/07 14:12:27 maxberger $ */ 018 019 package net.sourceforge.jeuclid.elements.generic; 020 021 import org.apache.batik.dom.AbstractDOMImplementation; 022 import org.w3c.dom.DOMImplementation; 023 import org.w3c.dom.Document; 024 import org.w3c.dom.DocumentType; 025 026 /** 027 * @version $Revision: 88b901bf20fb $ 028 */ 029 public final class JEuclidDOMImplementation extends AbstractDOMImplementation { 030 031 private static final long serialVersionUID = 1L; 032 033 private static final class SingletonHolder { 034 private static final JEuclidDOMImplementation INSTANCE = new JEuclidDOMImplementation(); 035 036 private SingletonHolder() { 037 } 038 } 039 040 /** 041 * Default Constructor. 042 */ 043 protected JEuclidDOMImplementation() { 044 super(); 045 } 046 047 /** {@inheritDoc} */ 048 public Document createDocument(final String namespaceURI, 049 final String qualifiedName, final DocumentType doctype) { 050 final Document result = new DocumentElement(doctype); 051 result.appendChild(result.createElementNS(namespaceURI, qualifiedName)); 052 return result; 053 } 054 055 /** {@inheritDoc} */ 056 public DocumentType createDocumentType(final String qualifiedName, 057 final String publicId, final String systemId) { 058 throw new UnsupportedOperationException(); 059 } 060 061 /** 062 * Retrieve the singleton instance of this {@link DOMImplementation}. 063 * 064 * @return a {@link DOMImplementation} implementing MathML DOM. 065 */ 066 public static DOMImplementation getInstance() { 067 return JEuclidDOMImplementation.SingletonHolder.INSTANCE; 068 } 069 }