Saxon.Api

 

 

Saxon.Api

Class ValidationFailure


public class ValidationFailure

This object represents a failure detected when validating an instance against a type defined in a schema.

The object holds information about the schema constraints that were violated, and the location in the instance document where the invalidity was detected. It is not an exception, because detection of invalid instances is not considered an abnormal condition and does not cause program termination.

Property Summary

 int ColumnNumber

Return the character position where the current document event ends.

 string ConstraintClauseNumber

Get the constraint clause number.

 string ConstraintName

Get the constraint name.

 string ConstraintReference

Get the constraint name and clause in the format defined in XML Schema Part C (Outcome Tabulations). This mandates the format validation-rule-name.clause-number

 string ContextPath

Get additional location text, if any.

 string ErrorCode

Get the error code associated with the validity error. This is relevant only when validation is run from within XSLT or XQuery, which define different error codes for validation errors.

 int LineNumber

Return the line number where the current document event ends.

 string Message

Get the text of a message explaining what is wrong.

 string Path

Get a hierarchic path giving the logical position in the instance document where the validation error was found.

 string PublicId

Return the public identifier for the current document event.

 int SchemaPart

Get the "schema part" component of the constraint reference.

 string SystemId

Return the system identifier for the current document event.

 

Property Detail

ColumnNumber

public int ColumnNumber {get; }

Return the character position where the current document event ends.

Returns:

the column number, or -1 if none is available

ConstraintClauseNumber

public string ConstraintClauseNumber {get; }

Get the constraint clause number.

Returns:

The section number of the clause containing the constraint that has been violated. Generally a decimal number in the form n.n.n; possibly a sequence of such numbers separated by semicolons.Or null if the information is not available.

ConstraintName

public string ConstraintName {get; }

Get the constraint name.

Returns:

The name of the violated constraint, in the form of a fragment identifier within the published XML Schema specification; or null if the information is not available.

ConstraintReference

public string ConstraintReference {get; }

Get the constraint name and clause in the format defined in XML Schema Part C (Outcome Tabulations). This mandates the format validation-rule-name.clause-number

Returns:

The constraint reference, for example "cos-ct-extends.1.2"; or null if the reference is not known.

ContextPath

public string ContextPath {get; }

Get additional location text, if any.

Returns:

Additional information about the location of the error, designed to be output as a prefix to the error message if desired.

ErrorCode

public string ErrorCode {get; }

Get the error code associated with the validity error. This is relevant only when validation is run from within XSLT or XQuery, which define different error codes for validation errors.

Returns:

The error code associated with the error, if any. The error is returned as a simple string if it is in the standard error namespace, or as an EQName (that is Q{uri}local) otherwise.

LineNumber

public int LineNumber {get; }

Return the line number where the current document event ends.

Returns:

The line number, or -1 if none is available.

Message

public string Message {get; }

Get the text of a message explaining what is wrong.

Returns:

A human-readable message explaining the validity error.

Path

public string Path {get; }

Get a hierarchic path giving the logical position in the instance document where the validation error was found.

Returns:

A path to the location in the document.

PublicId

public string PublicId {get; }

Return the public identifier for the current document event.

Returns:

A string containing the public identifier, or null if none is available.

SchemaPart

public int SchemaPart {get; }

Get the "schema part" component of the constraint reference.

Returns:

1 or 2 depending on whether the violated constraint is in XML Schema Part 1 or Part 2; or -1 if there is no constraint reference.

SystemId

public string SystemId {get; }

Return the system identifier for the current document event.

Returns:

A string containing the system identifier, or null if none is available.