1 2 9 10 package javax.xml.validation; 11 12 import java.io.File ; 13 import java.net.URL ; 14 15 import javax.xml.transform.Source ; 16 import javax.xml.transform.stream.StreamSource ; 17 18 import org.w3c.dom.ls.LSResourceResolver ; 19 import org.xml.sax.ErrorHandler ; 20 import org.xml.sax.SAXException ; 21 import org.xml.sax.SAXNotRecognizedException ; 22 import org.xml.sax.SAXNotSupportedException ; 23 24 94 public abstract class SchemaFactory { 95 96 private static SecuritySupport ss = new SecuritySupport (); 97 98 107 protected SchemaFactory() { 108 } 109 110 174 public static final SchemaFactory newInstance(String schemaLanguage) { 175 ClassLoader cl; 176 cl = ss.getContextClassLoader(); 177 178 if (cl == null) { 179 cl = SchemaFactory .class.getClassLoader(); 182 } 183 184 SchemaFactory f = new SchemaFactoryFinder (cl).newFactory(schemaLanguage); 185 if (f == null) { 186 throw new IllegalArgumentException (schemaLanguage); 187 } 188 return f; 189 } 190 191 203 public abstract boolean isSchemaLanguageSupported(String schemaLanguage); 204 205 226 public boolean getFeature(String name) throws SAXNotRecognizedException , SAXNotSupportedException { 227 228 if (name == null) { 229 throw new NullPointerException ("the name parameter is null"); 230 } 231 throw new SAXNotRecognizedException (name); 232 } 233 234 275 public void setFeature(String name, boolean value) throws SAXNotRecognizedException , SAXNotSupportedException { 276 277 if (name == null) { 278 throw new NullPointerException ("the name parameter is null"); 279 } 280 throw new SAXNotRecognizedException (name); 281 } 282 283 303 public void setProperty(String name, Object object) throws SAXNotRecognizedException , SAXNotSupportedException { 304 305 if (name == null) { 306 throw new NullPointerException ("the name parameter is null"); 307 } 308 throw new SAXNotRecognizedException (name); 309 } 310 311 335 public Object getProperty(String name) throws SAXNotRecognizedException , SAXNotSupportedException { 336 337 if (name == null) { 338 throw new NullPointerException ("the name parameter is null"); 339 } 340 throw new SAXNotRecognizedException (name); 341 } 342 343 401 public abstract void setErrorHandler(ErrorHandler errorHandler); 402 403 414 public abstract ErrorHandler getErrorHandler(); 415 416 461 public abstract void setResourceResolver(LSResourceResolver resourceResolver); 462 463 474 public abstract LSResourceResolver getResourceResolver(); 475 476 488 public Schema newSchema(Source schema) throws SAXException { 489 return newSchema(new Source []{schema}); 490 } 491 492 504 public Schema newSchema(File schema) throws SAXException { 505 return newSchema(new StreamSource (schema)); 506 } 507 508 520 public Schema newSchema(URL schema) throws SAXException { 521 return newSchema(new StreamSource (schema.toExternalForm())); 522 } 523 524 589 public abstract Schema newSchema(Source [] schemas) throws SAXException ; 590 591 634 public abstract Schema newSchema() throws SAXException ; 635 } 636 | Popular Tags |