SchemaFactory.NewInstance Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
NewInstance(String) |
Lookup an implementation of the |
NewInstance(String, String, ClassLoader) |
Returns an instance of the named implementation of |
NewInstance(String)
Lookup an implementation of the SchemaFactory
that supports the specified
schema language and return it.
[Android.Runtime.Register("newInstance", "(Ljava/lang/String;)Ljavax/xml/validation/SchemaFactory;", "")]
public static Javax.Xml.Validation.SchemaFactory? NewInstance (string? schemaLanguage);
[<Android.Runtime.Register("newInstance", "(Ljava/lang/String;)Ljavax/xml/validation/SchemaFactory;", "")>]
static member NewInstance : string -> Javax.Xml.Validation.SchemaFactory
Parameters
- schemaLanguage
- String
Specifies the schema language which the returned SchemaFactory will understand. See the list of available schema languages for the possible values.
Returns
New instance of a SchemaFactory
- Attributes
Exceptions
If no implementation of the schema language is available.
If the schemaLanguage
parameter is null.
Remarks
Lookup an implementation of the SchemaFactory
that supports the specified schema language and return it.
To find a SchemaFactory
object for a given schema language, this method looks the following places in the following order where "the class loader" refers to the context class loader:
<ol> <li> If the system property "javax.xml.validation.SchemaFactory:<i>schemaLanguage</i>"
is present (where schemaLanguage is the parameter to this method), then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created. </li> <li> $java.home/lib/jaxp.properties
is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above. </li> <li>
The class loader is asked for service provider provider-configuration files matching javax.xml.validation.SchemaFactory
in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. Each potential service provider is required to implement the method:
{@link #isSchemaLanguageSupported(String schemaLanguage)}
The first service provider found in class loader order that supports the specified schema language is returned. </li> <li> Platform default SchemaFactory
is located in a implementation specific way. There must be a platform default SchemaFactory
for W3C XML Schema. </li> </ol>
If everything fails, IllegalArgumentException
will be thrown.
<strong>Tip for Trouble-shooting:</strong>
See java.util.Properties#load(java.io.InputStream)
for exactly how a property file is parsed. In particular, colons ':' need to be escaped in a property file, so make sure schema language URIs are properly escaped in it. For example:
http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
Java documentation for javax.xml.validation.SchemaFactory.newInstance(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
NewInstance(String, String, ClassLoader)
Returns an instance of the named implementation of SchemaFactory
.
[Android.Runtime.Register("newInstance", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/validation/SchemaFactory;", "")]
public static Javax.Xml.Validation.SchemaFactory? NewInstance (string? schemaLanguage, string? factoryClassName, Java.Lang.ClassLoader? classLoader);
[<Android.Runtime.Register("newInstance", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/validation/SchemaFactory;", "")>]
static member NewInstance : string * string * Java.Lang.ClassLoader -> Javax.Xml.Validation.SchemaFactory
Parameters
- schemaLanguage
- String
Specifies the schema language which the returned SchemaFactory will understand. See <a href="#schemaLanguage">the list of available schema languages</a> for the possible values.
- factoryClassName
- String
- classLoader
- ClassLoader
Returns
New instance of a <code>SchemaFactory</code>
- Attributes
Exceptions
if factoryClassName
is not available, cannot be
instantiated, or doesn't support schemaLanguage
.
Remarks
Returns an instance of the named implementation of SchemaFactory
.
Added in 1.6.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.