SchemaFactory.NewSchema Method

Definition

Overloads

NewSchema(ISource[])

Parses the specified source(s) as a schema and returns it as a schema.

NewSchema(ISource)

Parses the specified source as a schema and returns it as a schema.

NewSchema()

Creates a special Schema object.

NewSchema(File)

Parses the specified File as a schema and returns it as a Schema.

NewSchema(URL)

Parses the specified URL as a schema and returns it as a Schema.

NewSchema(ISource[])

Parses the specified source(s) as a schema and returns it as a schema.

[Android.Runtime.Register("newSchema", "([Ljavax/xml/transform/Source;)Ljavax/xml/validation/Schema;", "GetNewSchema_arrayLjavax_xml_transform_Source_Handler")]
public abstract Javax.Xml.Validation.Schema? NewSchema (Javax.Xml.Transform.ISource[]? schemas);
[<Android.Runtime.Register("newSchema", "([Ljavax/xml/transform/Source;)Ljavax/xml/validation/Schema;", "GetNewSchema_arrayLjavax_xml_transform_Source_Handler")>]
abstract member NewSchema : Javax.Xml.Transform.ISource[] -> Javax.Xml.Validation.Schema

Parameters

schemas
ISource[]

inputs to be parsed. SchemaFactory is required to recognize StreamSource, javax.xml.transform.sax.SAXSource, and javax.xml.transform.dom.DOMSource.

Returns

Always return a non-null valid Schema object. Note that when an error has been reported, there is no guarantee that the returned Schema object is meaningful.

Attributes

Exceptions

If an error is found during processing the specified inputs. When an IErrorHandler is set, errors are reported to there first. See ErrorHandler.

If the schemas parameter itself is null or any item in the array is null.

If any item in the array is not recognized by this method.

If the schema language doesn't support this operation.

Remarks

Parses the specified source(s) as a schema and returns it as a schema.

The callee will read all the Sources and combine them into a single schema. The exact semantics of the combination depends on the schema language that this SchemaFactory object is created for.

When an ErrorHandler is set, the callee will report all the errors found in sources to the handler. If the handler throws an exception, it will abort the schema compilation and the same exception will be thrown from this method. Also, after an error is reported to a handler, the callee is allowed to abort the further processing by throwing it. If an error handler is not set, the callee will throw the first error it finds in the sources.

<h2>W3C XML Schema 1.0</h2>

The resulting schema contains components from the specified sources. The same result would be achieved if all these sources were imported, using appropriate values for schemaLocation and namespace, into a single schema document with a different targetNamespace and no components of its own, if the import elements were given in the same order as the sources. Section 4.2.3 of the XML Schema recommendation describes the options processors have in this regard. While a processor should be consistent in its treatment of JAXP schema sources and XML Schema imports, the behavior between JAXP-compliant parsers may vary; in particular, parsers may choose to ignore all but the first &lt;import> for a given namespace, regardless of information provided in schemaLocation.

If the parsed set of schemas includes error(s) as specified in the section 5.1 of the XML Schema spec, then the error must be reported to the ErrorHandler.

<h2>RELAX NG</h2>

For RELAX NG, this method must throw UnsupportedOperationException if schemas.length!=1.

Java documentation for javax.xml.validation.SchemaFactory.newSchema(javax.xml.transform.Source[]).

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

NewSchema(ISource)

Parses the specified source as a schema and returns it as a schema.

[Android.Runtime.Register("newSchema", "(Ljavax/xml/transform/Source;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljavax_xml_transform_Source_Handler")]
public virtual Javax.Xml.Validation.Schema? NewSchema (Javax.Xml.Transform.ISource? schema);
[<Android.Runtime.Register("newSchema", "(Ljavax/xml/transform/Source;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljavax_xml_transform_Source_Handler")>]
abstract member NewSchema : Javax.Xml.Transform.ISource -> Javax.Xml.Validation.Schema
override this.NewSchema : Javax.Xml.Transform.ISource -> Javax.Xml.Validation.Schema

Parameters

schema
ISource

Source that represents a schema.

Returns

New Schema from parsing schema.

Attributes

Exceptions

If a SAX error occurs during parsing.

if schema is null.

Remarks

Parses the specified source as a schema and returns it as a schema.

This is a convenience method for #newSchema(Source[] schemas).

Java documentation for javax.xml.validation.SchemaFactory.newSchema(javax.xml.transform.Source).

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

NewSchema()

Creates a special Schema object.

[Android.Runtime.Register("newSchema", "()Ljavax/xml/validation/Schema;", "GetNewSchemaHandler")]
public abstract Javax.Xml.Validation.Schema? NewSchema ();
[<Android.Runtime.Register("newSchema", "()Ljavax/xml/validation/Schema;", "GetNewSchemaHandler")>]
abstract member NewSchema : unit -> Javax.Xml.Validation.Schema

Returns

Always return non-null valid Schema object.

Attributes

Exceptions

If this operation is not supported by the callee.

If this operation is supported but failed for some reason.

Remarks

Creates a special Schema object.

The exact semantics of the returned Schema object depends on the schema language that this SchemaFactory is created for.

Also, implementations are allowed to use implementation-specific property/feature to alter the semantics of this method.

<h2>W3C XML Schema 1.0</h2>

For XML Schema, this method creates a Schema object that performs validation by using location hints specified in documents.

The returned Schema object assumes that if documents refer to the same URL in the schema location hints, they will always resolve to the same schema document. This assumption allows implementations to reuse parsed results of schema documents so that multiple validations against the same schema will run faster.

Note that the use of schema location hints introduces a vulnerability to denial-of-service attacks.

<h2>RELAX NG</h2>

RELAX NG does not support this operation.

Java documentation for javax.xml.validation.SchemaFactory.newSchema().

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

NewSchema(File)

Parses the specified File as a schema and returns it as a Schema.

[Android.Runtime.Register("newSchema", "(Ljava/io/File;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljava_io_File_Handler")]
public virtual Javax.Xml.Validation.Schema? NewSchema (Java.IO.File? schema);
[<Android.Runtime.Register("newSchema", "(Ljava/io/File;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljava_io_File_Handler")>]
abstract member NewSchema : Java.IO.File -> Javax.Xml.Validation.Schema
override this.NewSchema : Java.IO.File -> Javax.Xml.Validation.Schema

Parameters

schema
File

File that represents a schema.

Returns

New Schema from parsing schema.

Attributes

Exceptions

If a SAX error occurs during parsing.

if schema is null.

Remarks

Parses the specified File as a schema and returns it as a Schema.

This is a convenience method for #newSchema(Source schema).

Java documentation for javax.xml.validation.SchemaFactory.newSchema(java.io.File).

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

NewSchema(URL)

Parses the specified URL as a schema and returns it as a Schema.

[Android.Runtime.Register("newSchema", "(Ljava/net/URL;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljava_net_URL_Handler")]
public virtual Javax.Xml.Validation.Schema? NewSchema (Java.Net.URL? schema);
[<Android.Runtime.Register("newSchema", "(Ljava/net/URL;)Ljavax/xml/validation/Schema;", "GetNewSchema_Ljava_net_URL_Handler")>]
abstract member NewSchema : Java.Net.URL -> Javax.Xml.Validation.Schema
override this.NewSchema : Java.Net.URL -> Javax.Xml.Validation.Schema

Parameters

schema
URL

URL that represents a schema.

Returns

New Schema from parsing schema.

Attributes

Exceptions

If a SAX error occurs during parsing.

if schema is null.

Remarks

Parses the specified URL as a schema and returns it as a Schema.

This is a convenience method for #newSchema(Source schema).

Java documentation for javax.xml.validation.SchemaFactory.newSchema(java.net.URL).

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