1 16 17 package org.apache.xerces.impl.xs; 18 19 import org.apache.xerces.dom.CoreDOMImplementationImpl; 20 import org.apache.xerces.dom.DOMMessageFormatter; 21 import org.apache.xerces.impl.xs.util.StringListImpl; 22 import org.apache.xerces.xs.StringList; 23 import org.apache.xerces.xs.XSException; 24 import org.apache.xerces.xs.XSImplementation; 25 import org.apache.xerces.xs.XSLoader; 26 import org.w3c.dom.DOMImplementation ; 27 28 29 39 public class XSImplementationImpl extends CoreDOMImplementationImpl 40 implements XSImplementation { 41 42 46 48 49 static XSImplementationImpl singleton = new XSImplementationImpl(); 50 51 55 56 public static DOMImplementation getDOMImplementation() { 57 return singleton; 58 } 59 60 64 79 public boolean hasFeature(String feature, String version) { 80 81 return (feature.equalsIgnoreCase("XS-Loader") && (version == null || version.equals("1.0")) || 82 super.hasFeature(feature, version)); 83 } 85 86 87 90 public XSLoader createXSLoader(StringList versions) throws XSException { 91 XSLoader loader = new XSLoaderImpl(); 92 if (versions == null){ 93 return loader; 94 } 95 for (int i=0; i<versions.getLength();i++){ 96 if (!versions.item(i).equals("1.0")){ 97 String msg = 98 DOMMessageFormatter.formatMessage( 99 DOMMessageFormatter.DOM_DOMAIN, 100 "FEATURE_NOT_SUPPORTED", 101 new Object [] { versions.item(i) }); 102 throw new XSException(XSException.NOT_SUPPORTED_ERR, msg); 103 } 104 } 105 return loader; 106 } 107 108 111 public StringList getRecognizedVersions() { 112 StringListImpl list = new StringListImpl(new String []{"1.0"}, 1); 113 return list; 114 } 115 116 } | Popular Tags |