Share via


Validator.Validate Method

Definition

Overloads

Validate(ISource)

Validates the specified input.

Validate(ISource, IResult)

Validates the specified input and send the augmented validation result to the specified output.

Validate(ISource)

Validates the specified input.

[Android.Runtime.Register("validate", "(Ljavax/xml/transform/Source;)V", "GetValidate_Ljavax_xml_transform_Source_Handler")]
public virtual void Validate (Javax.Xml.Transform.ISource? source);
[<Android.Runtime.Register("validate", "(Ljavax/xml/transform/Source;)V", "GetValidate_Ljavax_xml_transform_Source_Handler")>]
abstract member Validate : Javax.Xml.Transform.ISource -> unit
override this.Validate : Javax.Xml.Transform.ISource -> unit

Parameters

source
ISource
Attributes

Exceptions

Remarks

Validates the specified input.

This is just a convenience method of:

validate(source,null);

Java documentation for javax.xml.validation.Validator.validate(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.

See also

Applies to

Validate(ISource, IResult)

Validates the specified input and send the augmented validation result to the specified output.

[Android.Runtime.Register("validate", "(Ljavax/xml/transform/Source;Ljavax/xml/transform/Result;)V", "GetValidate_Ljavax_xml_transform_Source_Ljavax_xml_transform_Result_Handler")]
public abstract void Validate (Javax.Xml.Transform.ISource? source, Javax.Xml.Transform.IResult? result);
[<Android.Runtime.Register("validate", "(Ljavax/xml/transform/Source;Ljavax/xml/transform/Result;)V", "GetValidate_Ljavax_xml_transform_Source_Ljavax_xml_transform_Result_Handler")>]
abstract member Validate : Javax.Xml.Transform.ISource * Javax.Xml.Transform.IResult -> unit

Parameters

source
ISource

XML to be validated. Must not be null.

result
IResult

The Result object that receives (possibly augmented) XML. This parameter can be null if the caller is not interested in it.

             Note that when a <code data-dev-comment-type="c">javax.xml.transform.dom.DOMResult</code> is used,
             a validator might just pass the same DOM node from
             <code data-dev-comment-type="c">javax.xml.transform.dom.DOMSource</code> to
             <code data-dev-comment-type="c">javax.xml.transform.dom.DOMResult</code>
             (in which case <code data-dev-comment-type="c">source.getNode()==result.getNode()</code>),
             it might copy the entire DOM tree, or it might alter the
             node given by the source.
Attributes

Exceptions

If the Result type doesn't match the ISource type, or if the specified source is not a SAXSource, DOMSource or StreamSource.

If the IErrorHandler throws a SAXException or if a fatal error is found and the IErrorHandler returns normally.

If the validator is processing a SAXSource and the underlying IXMLReader throws an IOException.

If the source parameter is null.

Remarks

Validates the specified input and send the augmented validation result to the specified output.

This method places the following restrictions on the types of the Source/Result accepted.

<h4>Source/Result accepted:</h4> <table border=1> <thead> <tr> <td></td> <td>javax.xml.transform.sax.SAXSource</td> <td>javax.xml.transform.dom.DOMSource</td> <td>javax.xml.transform.stream.StreamSource</td> </tr> </thead> <tbody> <tr> <td>null</td> <td>OK</td> <td>OK</td> <td>OK</td> <td>OK</td> </tr> <tr> <td>javax.xml.transform.sax.SAXResult</td> <td>OK</td> <td>Err</td> <td>Err</td> <td>Err</td> </tr> <tr> <td>javax.xml.transform.dom.DOMResult</td> <td>Err</td> <td>OK</td> <td>Err</td> <td>Err</td> </tr> <tr> <td>javax.xml.transform.stream.StreamResult</td> <td>Err</td> <td>Err</td> <td>Err</td> <td>OK</td> </tr> </tbody> </table>

To validate one Source into another kind of Result, use the identity transformer (see javax.xml.transform.TransformerFactory#newTransformer()).

Errors found during the validation is sent to the specified ErrorHandler.

If a document is valid, or if a document contains some errors but none of them were fatal and the ErrorHandler didn't throw any exception, then the method returns normally.

Java documentation for javax.xml.validation.Validator.validate(javax.xml.transform.Source, javax.xml.transform.Result).

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.

See also

Applies to