Class MessageEmitter

  • All Implemented Interfaces:
    javax.xml.transform.Result, Receiver, ReceiverWithOutputProperties

    public class MessageEmitter
    extends XMLEmitter
    MessageEmitter is the default Receiver for xsl:message output. It is the same as XMLEmitter except that (a) it adds an extra newline at the end of the message, and (b) it recognizes a processing-instruction with name "error-code" specially; this is assumed to contain the error-code requested on the xsl:message instruction. These changes can be overridden in a user-supplied subclass.
    • Constructor Detail

      • MessageEmitter

        public MessageEmitter()
    • Method Detail

      • setWriter

        public void setWriter​(java.io.Writer writer)
      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          UnicodeString data,
                                          Location locationId,
                                          int properties)
                                   throws XPathException
        Description copied from class: XMLEmitter
        Handle a processing instruction.
        Specified by:
        processingInstruction in interface Receiver
        Overrides:
        processingInstruction in class XMLEmitter
        Parameters:
        target - The PI name. This must be a legal name (it will not be checked).
        data - The data portion of the processing instruction
        locationId - provides information such as line number and system ID.
        properties - Additional information about the PI.
        Throws:
        XPathException - if an error occurs
      • suppressProcessingInstruction

        protected boolean suppressProcessingInstruction​(java.lang.String target,
                                                        UnicodeString data,
                                                        Location locationId,
                                                        int properties)
        Method to decide whether a processing instruction in the message should be suppressed. The default implementation suppresses a processing instruction whose target is "error-code"; this processing instruction is inserted into the message; its data part is an EQName containing the error code.
        Parameters:
        target - the processing instruction target (that is, name)
        data - the data part of the processing instruction
        locationId - the location, which in the case of the error-code processing instruction, holds the location of the originating xsl:message instruction
        properties - currently 0.
        Returns:
        true if the processing instruction is to be suppressed from the displayed message.