1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.xerces.internal.impl.xs.opti; 23 import org.w3c.dom.DOMException; 24 import org.w3c.dom.DOMImplementation; 25 import org.w3c.dom.Document; 26 import org.w3c.dom.DocumentType; 27 28 /** 29 * @xerces.internal 30 * 31 */ 32 final class SchemaDOMImplementation implements DOMImplementation { 33 34 private static final SchemaDOMImplementation singleton = new SchemaDOMImplementation(); 35 36 /** NON-DOM: Obtain and return the single shared object */ getDOMImplementation()37 public static DOMImplementation getDOMImplementation() { 38 return singleton; 39 } 40 SchemaDOMImplementation()41 private SchemaDOMImplementation() {} 42 createDocument(String namespaceURI, String qualifiedName, DocumentType doctype)43 public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) 44 throws DOMException { 45 throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); 46 } 47 createDocumentType(String qualifiedName, String publicId, String systemId)48 public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) 49 throws DOMException { 50 throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); 51 } 52 getFeature(String feature, String version)53 public Object getFeature(String feature, String version) { 54 if (singleton.hasFeature(feature, version)) { 55 return singleton; 56 } 57 return null; 58 } 59 hasFeature(String feature, String version)60 public boolean hasFeature(String feature, String version) { 61 final boolean anyVersion = version == null || version.length() == 0; 62 return (feature.equalsIgnoreCase("Core") || feature.equalsIgnoreCase("XML")) && 63 (anyVersion || version.equals("1.0") || version.equals("2.0") || version.equals("3.0")); 64 } 65 66 } 67