org.apache.xpath
Class XPathException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javax.xml.transform.TransformerException
              extended by org.apache.xpath.XPathException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XPathProcessorException

public class XPathException
extends javax.xml.transform.TransformerException

This class implements an exception object that all XPath classes will throw in case of an error. This class extends TransformerException, and may hold other exceptions. In the case of nested exceptions, printStackTrace will dump all the traces of the nested exceptions, not just the trace of this object.

See Also:
Serialized Form

Field Summary
protected  java.lang.Exception m_exception
          A nested exception.
(package private)  java.lang.Object m_styleNode
          The home of the expression that caused the error.
(package private) static long serialVersionUID
           
 
Constructor Summary
XPathException(java.lang.String message)
          Create an XPathException object that holds an error message.
XPathException(java.lang.String message, java.lang.Exception e)
          Create an XPathException object that holds an error message, and another exception that caused this exception.
XPathException(java.lang.String message, ExpressionNode ex)
          Create an XPathException object that holds an error message.
XPathException(java.lang.String message, org.w3c.dom.Node styleNode, java.lang.Exception e)
          Create an XPathException object that holds an error message, the stylesheet node that the error originated from, and another exception that caused this exception.
XPathException(java.lang.String message, java.lang.Object styleNode)
          Create an XPathException object that holds an error message and the stylesheet node that the error originated from.
 
Method Summary
 java.lang.Throwable getException()
          Return the embedded exception, if any.
protected  ExpressionNode getExpressionOwner(ExpressionNode ex)
          Get the first non-Expression parent of this node.
 java.lang.String getMessage()
          Find the most contained message.
 java.lang.Object getStylesheetNode()
          Get the stylesheet node from where this error originated.
 org.w3c.dom.Node getStylesheetNode(ExpressionNode ex)
          Get the XSLT ElemVariable that this sub-expression references.
 void printStackTrace(java.io.PrintStream s)
          Print the the trace of methods from where the error originated.
 void printStackTrace(java.io.PrintWriter s)
          Print the the trace of methods from where the error originated.
 void setStylesheetNode(java.lang.Object styleNode)
          Set the stylesheet node from where this error originated.
 
Methods inherited from class javax.xml.transform.TransformerException
getCause, getLocationAsString, getLocator, getMessageAndLocation, initCause, printStackTrace, setLocator
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

m_styleNode

java.lang.Object m_styleNode
The home of the expression that caused the error.


m_exception

protected java.lang.Exception m_exception
A nested exception.

Constructor Detail

XPathException

public XPathException(java.lang.String message,
                      ExpressionNode ex)
Create an XPathException object that holds an error message.

Parameters:
message - The error message.

XPathException

public XPathException(java.lang.String message)
Create an XPathException object that holds an error message.

Parameters:
message - The error message.

XPathException

public XPathException(java.lang.String message,
                      java.lang.Object styleNode)
Create an XPathException object that holds an error message and the stylesheet node that the error originated from.

Parameters:
message - The error message.
styleNode - The stylesheet node that the error originated from.

XPathException

public XPathException(java.lang.String message,
                      org.w3c.dom.Node styleNode,
                      java.lang.Exception e)
Create an XPathException object that holds an error message, the stylesheet node that the error originated from, and another exception that caused this exception.

Parameters:
message - The error message.
styleNode - The stylesheet node that the error originated from.
e - The exception that caused this exception.

XPathException

public XPathException(java.lang.String message,
                      java.lang.Exception e)
Create an XPathException object that holds an error message, and another exception that caused this exception.

Parameters:
message - The error message.
e - The exception that caused this exception.
Method Detail

getStylesheetNode

public java.lang.Object getStylesheetNode()
Get the stylesheet node from where this error originated.

Returns:
The stylesheet node from where this error originated, or null.

setStylesheetNode

public void setStylesheetNode(java.lang.Object styleNode)
Set the stylesheet node from where this error originated.

Parameters:
styleNode - The stylesheet node from where this error originated, or null.

getStylesheetNode

public org.w3c.dom.Node getStylesheetNode(ExpressionNode ex)
Get the XSLT ElemVariable that this sub-expression references. In order for this to work, the SourceLocator must be the owning ElemTemplateElement.

Returns:
The dereference to the ElemVariable, or null if not found.

getExpressionOwner

protected ExpressionNode getExpressionOwner(ExpressionNode ex)
Get the first non-Expression parent of this node.

Returns:
null or first ancestor that is not an Expression.

printStackTrace

public void printStackTrace(java.io.PrintStream s)
Print the the trace of methods from where the error originated. This will trace all nested exception objects, as well as this object.

Overrides:
printStackTrace in class javax.xml.transform.TransformerException
Parameters:
s - The stream where the dump will be sent to.

getMessage

public java.lang.String getMessage()
Find the most contained message.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The error message of the originating exception.

printStackTrace

public void printStackTrace(java.io.PrintWriter s)
Print the the trace of methods from where the error originated. This will trace all nested exception objects, as well as this object.

Overrides:
printStackTrace in class javax.xml.transform.TransformerException
Parameters:
s - The writer where the dump will be sent to.

getException

public java.lang.Throwable getException()
Return the embedded exception, if any. Overrides javax.xml.transform.TransformerException.getException().

Overrides:
getException in class javax.xml.transform.TransformerException
Returns:
The embedded exception, or null if there is none.