Condividi tramite


DocumentBuilderFactory.Schema Property

Definition

Gets the Schema object specified through the #setSchema(Schema schema) method. -or- Set the Schema to be used by parsers created from this factory.

public virtual Javax.Xml.Validation.Schema? Schema { [Android.Runtime.Register("getSchema", "()Ljavax/xml/validation/Schema;", "GetGetSchemaHandler")] get; [Android.Runtime.Register("setSchema", "(Ljavax/xml/validation/Schema;)V", "GetSetSchema_Ljavax_xml_validation_Schema_Handler")] set; }
[<get: Android.Runtime.Register("getSchema", "()Ljavax/xml/validation/Schema;", "GetGetSchemaHandler")>]
[<set: Android.Runtime.Register("setSchema", "(Ljavax/xml/validation/Schema;)V", "GetSetSchema_Ljavax_xml_validation_Schema_Handler")>]
member this.Schema : Javax.Xml.Validation.Schema with get, set

Property Value

the Schema object that was last set through the #setSchema(Schema) method, or null if the method was not invoked since a DocumentBuilderFactory is created.

Attributes

Exceptions

For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.

Remarks

Property getter documentation:

Gets the Schema object specified through the #setSchema(Schema schema) method.

Added in 1.5.

Java documentation for javax.xml.parsers.DocumentBuilderFactory.getSchema().

Property setter documentation:

Set the Schema to be used by parsers created from this factory.

When a Schema is non-null, a parser will use a validator created from it to validate documents before it passes information down to the application.

When errors are found by the validator, the parser is responsible to report them to the user-specified org.xml.sax.ErrorHandler (or if the error handler is not set, ignore them or throw them), just like any other errors found by the parser itself. In other words, if the user-specified org.xml.sax.ErrorHandler is set, it must receive those errors, and if not, they must be treated according to the implementation specific default error handling rules.

A validator may modify the outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.

Initially, null is set as the Schema.

This processing will take effect even if the #isValidating() method returns false.

It is an error to use the http://java.sun.com/xml/jaxp/properties/schemaSource property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage property in conjunction with a Schema object. Such configuration will cause a ParserConfigurationException exception when the #newDocumentBuilder() is invoked.

<h4>Note for implementors</h4>

A parser must be able to work with any Schema implementation. However, parsers and schemas are allowed to use implementation-specific custom mechanisms as long as they yield the result described in the specification.

Added in 1.5.

Java documentation for javax.xml.parsers.DocumentBuilderFactory.setSchema(javax.xml.validation.Schema).

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