Package net.sf.saxon.s9api
Class Message
java.lang.Object
net.sf.saxon.s9api.Message
A
Message represents the output of an xsl:message or
xsl:assert instruction.
The content of a message is always an XDM document node (in the common case of purely textual messages, the document node will have a single text node child).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the content of the messageGet the error code associated with the message.Get the location of thexsl:messageorxsl:assertinstruction within the containing stylesheetGet the string value of the message.booleanAsk whetherterminate="yes"was specified on the call ofxsl:message.voidIndicate that the message is to be treated as terminal (causing the transformation to fail).toString()Get the message content as a string, using XML serialization with options method="xml", indent="yes", omit-xml-declaration="yes".
-
Constructor Details
-
Message
Construct a Message. This constructor is used internally by thexsl:messageinstruction.- Parameters:
content- the content of the messageerrorCode- the error code associated with the messageterminate- true ifterminate="yes"was specified on the xsl:messagelocation- the location of the xsl:message instruction
-
-
Method Details
-
getContent
Get the content of the message- Returns:
- the content of the message as an XDM document node
-
getStringValue
Get the string value of the message. This is a shortcut forgetContent().getStringValue(). It returns the content of the message as a string, without XML escaping, and ignoring any XML markup.- Returns:
- the message as an unescaped string
-
toString
Get the message content as a string, using XML serialization with options method="xml", indent="yes", omit-xml-declaration="yes". This is a shortcut forgetContent().toString(). The result may include XML markup and XML escaping, though there is no guarantee that it will be a well-formed XML document (it may be a document fragment). -
getErrorCode
Get the error code associated with the message. If no error code was supplied in the call ofxsl:messageorxsl:assert, the default codeXTMM9000orXTMM9001is used. System-defined error codes use the namespaceNamespaceConstant.ERR.- Returns:
- the error code
-
raiseDynamicError
public void raiseDynamicError()Indicate that the message is to be treated as terminal (causing the transformation to fail). A user-written message handler can call this method to indicate that Saxon should treat the message as ifterminate=yeshad been specified in thexsl:messageinstruction. The effect is that thexsl:messageinstruction fails with a dynamic error; note that the stylesheet can catch this error usingxsl:catch. -
isTerminate
public boolean isTerminate()Ask whetherterminate="yes"was specified on the call ofxsl:message. For anxsl:assertinstruction the value is always true.- Returns:
- true if the transformation will terminate after the message has been output
-
getLocation
Get the location of thexsl:messageorxsl:assertinstruction within the containing stylesheet- Returns:
- the location of the originating instruction
-