1 57 58 package com.sun.org.apache.xerces.internal.impl.xs; 59 60 import com.sun.org.apache.xerces.internal.dom.CoreDOMImplementationImpl; 61 import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter; 62 import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl; 63 import com.sun.org.apache.xerces.internal.xs.StringList; 64 import com.sun.org.apache.xerces.internal.xs.XSException; 65 import com.sun.org.apache.xerces.internal.xs.XSImplementation; 66 import com.sun.org.apache.xerces.internal.xs.XSLoader; 67 import org.w3c.dom.DOMImplementation ; 68 69 70 78 public class XSImplementationImpl extends CoreDOMImplementationImpl 79 implements XSImplementation { 80 81 85 87 88 static XSImplementationImpl singleton = new XSImplementationImpl(); 89 90 94 95 public static DOMImplementation getDOMImplementation() { 96 return singleton; 97 } 98 99 103 118 public boolean hasFeature(String feature, String version) { 119 120 return (feature.equalsIgnoreCase("XS-Loader") && (version == null || version.equals("1.0")) || 121 super.hasFeature(feature, version)); 122 } 124 125 126 129 public XSLoader createXSLoader(StringList versions) throws XSException { 130 XSLoader loader = new XMLSchemaLoader(); 131 if (versions == null){ 132 return loader; 133 } 134 for (int i=0; i<versions.getLength();i++){ 135 if (!versions.item(i).equals("1.0")){ 136 String msg = 137 DOMMessageFormatter.formatMessage( 138 DOMMessageFormatter.DOM_DOMAIN, 139 "FEATURE_NOT_SUPPORTED", 140 new Object [] { versions.item(i) }); 141 throw new XSException(XSException.NOT_SUPPORTED_ERR, msg); 142 } 143 } 144 return loader; 145 } 146 147 150 public StringList getRecognizedVersions() { 151 StringListImpl list = new StringListImpl(new String []{"1.0"}, 1); 152 return list; 153 } 154 155 } | Popular Tags |