Saxon.Api

 

 

Saxon.Api

Class ValidationFailure


public class ValidationFailure

This exception indicates a failure when validating an instance against a type defined in a schema.

This class holds the same information as a ValidationException, except that it is not an exception, and does not carry system overheads such as a stack trace.It is used because operations such as "castable", and validation of values in a union, cause validation failures on a success path and it is costly to throw, or even to create, exception objects on a success path.

Method Summary

 int GetColumnNumber()

Return the character position where the current document event ends.

 string GetConstraintClauseNumber()

Get the constraint clause number

 string GetConstraintName()

Get the constraint name

 string getConstraintReference()

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 GetContextPath()

Get additional location text, if any.

 string GetErrorCode()

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 validition errors

 int GetLineNumber()

Return the line number where the current document event ends.

 string GetMessage()

Get the text of a message explaing what is wrong

 string GetPath()

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

 string GetPublicId()

Return the public identifier for the current document event.

 int GetSchemaPart()

Get the "schema part" component of the constraint reference

 string GetSystemId()

Return the system identifier for the current document event

 

Method Detail

GetColumnNumber

public int GetColumnNumber()

Return the character position where the current document event ends.

Returns:

the column number, or -1 if none is available

GetConstraintClauseNumber

public string GetConstraintClauseNumber()

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.

GetConstraintName

public string GetConstraintName()

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.

getConstraintReference

public string getConstraintReference()

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.

GetContextPath

public string GetContextPath()

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

GetErrorCode

public string GetErrorCode()

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 validition 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.

GetLineNumber

public int GetLineNumber()

Return the line number where the current document event ends.

Returns:

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

GetMessage

public string GetMessage()

Get the text of a message explaing what is wrong

Returns:

a human-readable message explaining the validity error

GetPath

public string GetPath()

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

GetPublicId

public string GetPublicId()

Return the public identifier for the current document event.

Returns:

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

GetSchemaPart

public int GetSchemaPart()

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

GetSystemId

public string GetSystemId()

Return the system identifier for the current document event

Returns:

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