Package net.sf.saxon.trans
Class XmlProcessingIncident
java.lang.Object
net.sf.saxon.trans.XmlProcessingIncident
- All Implemented Interfaces:
XmlProcessingError
The XmlProcessingIncident class is a concrete implementation of the
XmlProcessingError
interface that holds all the required information internally. (That is, no exception objects
are involved.)-
Constructor Summary
ConstructorsConstructorDescriptionXmlProcessingIncident(String message) Create an IncidentXmlProcessingIncident(String message, String errorCode) Create an IncidentXmlProcessingIncident(String message, String errorCode, Location location) Create an XmlProcessingIncidentXmlProcessingIncident(TransformerException err, boolean isWarning) -
Method Summary
Modifier and TypeMethodDescriptionReturn an XmlProcessingError containing the same information, but to be treated as a warning conditiongetCause()Return the underlying exception.intThe column number locating the error within a query or stylesheet moduleThe error code, as a QName.Get the Expression that failed, if knownGet a name identifying the kind of instruction, in terms meaningful to a user.intThe line number locating the error within a query or stylesheet moduleGet the location information associated with the errorReturn the error message associated with this errorThe URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream)getPath()Get the absolute XPath expression that identifies the node within its document where the error occurred, if availableAsk whether this error is to be treated as fatal, and return the associated messagebooleanAsk whether this static error has already been reportedbooleanAsk whether this is a static error, defined as an error that can be detected during static analysis of a stylesheet, query, schema, or XPath expression.booleanAsk whether this is a type error.booleanAsk whether this error is being reported as a warning condition.static voidmaybeSetHostLanguage(XmlProcessingError error, HostLanguage lang) static voidmaybeSetLocation(XmlProcessingError error, Location loc) voidsetAlreadyReported(boolean reported) Say whether this error has already been reportedvoidvoidsetErrorCodeAsEQName(String code) voidvoidsetHostLanguage(HostLanguage language) voidsetLocation(Location loc) voidsetStaticError(boolean isStaticError) voidsetTerminationMessage(String message) Indicate that this error is to be treated as fatal; that is, execution will be abandoned after reporting this error.voidsetTypeError(boolean isTypeError) voidsetWarning(boolean warning)
-
Constructor Details
-
XmlProcessingIncident
Create an XmlProcessingIncident- Parameters:
message- the error messageerrorCode- the error code, supplied either as a local name, or inQ{uri}localformat. If supplied as a local name, the standard error namespace is assumed.location- the location of the error
-
XmlProcessingIncident
Create an Incident- Parameters:
message- the error message
-
XmlProcessingIncident
Create an Incident- Parameters:
message- the error messageerrorCode- the error code, supplied either as a local name, or inQ{uri}localformat. If supplied as a local name, the standard error namespace is assumed.
-
XmlProcessingIncident
-
-
Method Details
-
setWarning
public void setWarning(boolean warning) -
asWarning
Description copied from interface:XmlProcessingErrorReturn an XmlProcessingError containing the same information, but to be treated as a warning condition- Specified by:
asWarningin interfaceXmlProcessingError- Returns:
- an XmlProcessingError to be treated as a warning
-
setTerminationMessage
Indicate that this error is to be treated as fatal; that is, execution will be abandoned after reporting this error. This method may be called by anErrorReporter, for example if the error is considered so severe that further processing is not worthwhile, or if too many errors have been signalled. There is no absolute guarantee that setting this property will cause execution to be abandoned. If a dynamic error is marked as fatal, it will generally not be caught by any try/catch mechanism within the stylesheet or query.- Specified by:
setTerminationMessagein interfaceXmlProcessingError- Parameters:
message- an error message giving the reason for the fatal error
-
getTerminationMessage
Ask whether this error is to be treated as fatal, and return the associated message- Specified by:
getTerminationMessagein interfaceXmlProcessingError- Returns:
- a non-null message if the error has been marked as a fatal error.
-
isAlreadyReported
public boolean isAlreadyReported()Ask whether this static error has already been reported- Specified by:
isAlreadyReportedin interfaceXmlProcessingError- Returns:
- true if the error has already been reported
-
setAlreadyReported
public void setAlreadyReported(boolean reported) Say whether this error has already been reported- Specified by:
setAlreadyReportedin interfaceXmlProcessingError- Parameters:
reported- true if the error has been reported
-
getHostLanguage
- Specified by:
getHostLanguagein interfaceXmlProcessingError
-
setHostLanguage
-
isTypeError
public boolean isTypeError()Description copied from interface:XmlProcessingErrorAsk whether this is a type error. Saxon reports type errors statically if it can establish that a supplied value will never satisfy the required type- Specified by:
isTypeErrorin interfaceXmlProcessingError- Returns:
- true if this is a type error
-
setTypeError
public void setTypeError(boolean isTypeError) -
isStaticError
public boolean isStaticError()Description copied from interface:XmlProcessingErrorAsk whether this is a static error, defined as an error that can be detected during static analysis of a stylesheet, query, schema, or XPath expression.- Specified by:
isStaticErrorin interfaceXmlProcessingError- Returns:
- true if this is a static error
-
setStaticError
public void setStaticError(boolean isStaticError) -
getErrorCode
The error code, as a QName. May be null if no error code has been assigned- Specified by:
getErrorCodein interfaceXmlProcessingError- Returns:
- QName
-
setErrorCodeAsEQName
-
getMessage
Return the error message associated with this error- Specified by:
getMessagein interfaceXmlProcessingError- Returns:
- String
-
getModuleUri
The URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream)- Specified by:
getModuleUriin interfaceXmlProcessingError- Returns:
- String
-
getFailingExpression
Description copied from interface:XmlProcessingErrorGet the Expression that failed, if known- Specified by:
getFailingExpressionin interfaceXmlProcessingError- Returns:
- the failing expression, or null
-
setFailingExpression
-
getLocation
Description copied from interface:XmlProcessingErrorGet the location information associated with the error- Specified by:
getLocationin interfaceXmlProcessingError- Returns:
- the location of the error. The result is never null, though it may be a location with little useful information.
-
setLocation
-
getColumnNumber
public int getColumnNumber()The column number locating the error within a query or stylesheet module- Returns:
- int
-
getLineNumber
public int getLineNumber()The line number locating the error within a query or stylesheet module- Returns:
- int
-
getInstructionName
Get a name identifying the kind of instruction, in terms meaningful to a user. This method is not used in the case where the instruction name code is a standard name (<1024).- Returns:
- a name identifying the kind of instruction, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the instruction.
-
isWarning
public boolean isWarning()Ask whether this error is being reported as a warning condition. If so, applications may ignore the condition, though the results may not be as intended.- Specified by:
isWarningin interfaceXmlProcessingError- Returns:
- boolean
-
getPath
Get the absolute XPath expression that identifies the node within its document where the error occurred, if available- Specified by:
getPathin interfaceXmlProcessingError- Returns:
- String - a path expression
-
getCause
Return the underlying exception. This method may not be stable across Saxon releases.- Specified by:
getCausein interfaceXmlProcessingError- Returns:
- the underlying exception if there was one, or null otherwise
-
setCause
-
maybeSetHostLanguage
-
maybeSetLocation
-