View Javadoc

1   /*
2    * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /* $Id: JEuclidDOMImplementation.java,v 88b901bf20fb 2008/06/07 14:12:27 maxberger $ */
18  
19  package net.sourceforge.jeuclid.elements.generic;
20  
21  import org.apache.batik.dom.AbstractDOMImplementation;
22  import org.w3c.dom.DOMImplementation;
23  import org.w3c.dom.Document;
24  import org.w3c.dom.DocumentType;
25  
26  /**
27   * @version $Revision: 88b901bf20fb $
28   */
29  public final class JEuclidDOMImplementation extends AbstractDOMImplementation {
30  
31      private static final long serialVersionUID = 1L;
32  
33      private static final class SingletonHolder {
34          private static final JEuclidDOMImplementation INSTANCE = new JEuclidDOMImplementation();
35  
36          private SingletonHolder() {
37          }
38      }
39  
40      /**
41       * Default Constructor.
42       */
43      protected JEuclidDOMImplementation() {
44          super();
45      }
46  
47      /** {@inheritDoc} */
48      public Document createDocument(final String namespaceURI,
49              final String qualifiedName, final DocumentType doctype) {
50          final Document result = new DocumentElement(doctype);
51          result.appendChild(result.createElementNS(namespaceURI, qualifiedName));
52          return result;
53      }
54  
55      /** {@inheritDoc} */
56      public DocumentType createDocumentType(final String qualifiedName,
57              final String publicId, final String systemId) {
58          throw new UnsupportedOperationException();
59      }
60  
61      /**
62       * Retrieve the singleton instance of this {@link DOMImplementation}.
63       * 
64       * @return a {@link DOMImplementation} implementing MathML DOM.
65       */
66      public static DOMImplementation getInstance() {
67          return JEuclidDOMImplementation.SingletonHolder.INSTANCE;
68      }
69  }