|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.type.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.
Constructor Summary | |
---|---|
ValidationFailure(Exception exception)
Creates a new ValidationFailure with the given nested exception. |
|
ValidationFailure(String message)
Creates a new ValidationException with the given message. |
Method Summary | |
---|---|
AtomicValue |
asAtomic()
Calling this method on a ConversionResult returns the AtomicValue that results from the conversion if the conversion was successful, and throws a ValidationException explaining the conversion error otherwise. |
int |
getColumnNumber()
|
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). |
String |
getConstraintReferenceMessage()
Get the constraint reference as a string for inserting into an error message. |
int |
getConstraintSchemaPart()
Get the "schema part" component of the constraint reference |
String |
getErrorCode()
|
int |
getLineNumber()
|
SourceLocator |
getLocator()
|
String |
getMessage()
|
String |
getPublicId()
|
String |
getSystemId()
|
ValidationException |
makeException()
|
void |
setColumnNumber(int column)
|
void |
setConstraintReference(int schemaPart,
String constraintName,
String clause)
Set a reference to the constraint in XML Schema that is not satisfied |
void |
setConstraintReference(ValidationFailure e)
Copy the constraint reference from another exception object |
void |
setErrorCode(String errorCode)
|
void |
setLineNumber(int line)
|
void |
setLocator(SourceLocator locator)
|
void |
setPublicId(String id)
|
void |
setSourceLocator(SourceLocator locator)
|
void |
setSystemId(String id)
|
String |
toString()
Returns the String representation of this Exception |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ValidationFailure(String message)
message
- the message for this Exceptionpublic ValidationFailure(Exception exception)
exception
- the nested exceptionMethod Detail |
---|
public void setConstraintReference(int schemaPart, String constraintName, String clause)
schemaPart
- - 1 or 2, depending whether the constraint is in XMLSchema part 1 or part 2constraintName
- - the short name of the constraint in XMLSchema, as a fragment identifier in the
HTML of the XML Schema Part 1 specificationclause
- - the clause number within the description of that constraintpublic void setConstraintReference(ValidationFailure e)
e
- the other exception object from which to copy the informationpublic String getConstraintReferenceMessage()
public int getConstraintSchemaPart()
public String getConstraintName()
public String getConstraintClauseNumber()
public String getConstraintReference()
public String getMessage()
public String toString()
toString
in class Object
public String getPublicId()
getPublicId
in interface SourceLocator
getPublicId
in interface Locator
public String getSystemId()
getSystemId
in interface SourceLocator
getSystemId
in interface Locator
public int getLineNumber()
getLineNumber
in interface SourceLocator
getLineNumber
in interface Locator
public int getColumnNumber()
getColumnNumber
in interface SourceLocator
getColumnNumber
in interface Locator
public void setPublicId(String id)
public void setSystemId(String id)
public void setLineNumber(int line)
public void setColumnNumber(int column)
public void setLocator(SourceLocator locator)
public void setSourceLocator(SourceLocator locator)
public SourceLocator getLocator()
public void setErrorCode(String errorCode)
public String getErrorCode()
public ValidationException makeException()
public AtomicValue asAtomic() throws ValidationException
Use this method if you are calling a conversion method that returns a ConversionResult, and if you want to throw an exception if the conversion fails.
asAtomic
in interface ConversionResult
ValidationException
- if the conversion was not successful
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |