xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sb...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xpath XPathProcessorException.java XPathException.java
Date Fri, 29 Mar 2002 15:17:20 GMT
sboag       02/03/29 07:17:20

  Modified:    java/src/org/apache/xpath XPathProcessorException.java
                        XPathException.java
  Log:
  Pass in the parent ExpressionNode, so that more context information can be
  set.  For the moment, I've added methods that are dependent on the
  XSLT module, to set the source stylesheet node.  I'll deal with this more when
  I deal with the proper breakup and packaging of the XPath package, in a
  few days.
  
  Revision  Changes    Path
  1.3       +1 -0      xml-xalan/java/src/org/apache/xpath/XPathProcessorException.java
  
  Index: XPathProcessorException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathProcessorException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XPathProcessorException.java	30 Oct 2000 18:58:29 -0000	1.2
  +++ XPathProcessorException.java	29 Mar 2002 15:17:20 -0000	1.3
  @@ -73,6 +73,7 @@
     {
       super(message);
     }
  +  
   
     /**
      * Create an XPathProcessorException object that holds
  
  
  
  1.7       +59 -1     xml-xalan/java/src/org/apache/xpath/XPathException.java
  
  Index: XPathException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathException.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XPathException.java	2 Jan 2001 03:47:13 -0000	1.6
  +++ XPathException.java	29 Mar 2002 15:17:20 -0000	1.7
  @@ -56,9 +56,12 @@
    */
   package org.apache.xpath;
   
  -import org.w3c.dom.Node;
  +import java.io.PrintStream;
  +import java.io.PrintWriter;
   
   import javax.xml.transform.TransformerException;
  +import org.apache.xalan.templates.ElemTemplateElement;
  +import org.w3c.dom.Node;
   
   /**
    * <meta name="usage" content="general"/>
  @@ -84,6 +87,16 @@
     {
       return m_styleNode;
     }
  +  
  +  /**
  +   * Set the stylesheet node from where this error originated.
  +   * @param styleNode The stylesheet node from where this error originated, or null.
  +   */
  +  public void setStylesheetNode(Object styleNode)
  +  {
  +    m_styleNode = styleNode;
  +  }
  +
   
     /** A nested exception.
      *  @serial   */
  @@ -94,10 +107,55 @@
      * an error message.
      * @param message The error message.
      */
  +  public XPathException(String message, ExpressionNode ex)
  +  {
  +    super(message);
  +    this.setLocator(ex);
  +    setStylesheetNode(getStylesheetNode(ex));
  +  }
  +  
  +  /**
  +   * Create an XPathException object that holds
  +   * an error message.
  +   * @param message The error message.
  +   */
     public XPathException(String message)
     {
       super(message);
     }
  +
  +  
  +  /**
  +   * Get the XSLT ElemVariable that this sub-expression references.  In order for 
  +   * this to work, the SourceLocator must be the owning ElemTemplateElement.
  +   * @return The dereference to the ElemVariable, or null if not found.
  +   */
  +  public Object getStylesheetNode(ExpressionNode ex)
  +  {
  +  	
  +    ExpressionNode owner = getExpressionOwner(ex);
  +
  +    if (null != owner && owner instanceof org.apache.xalan.templates.ElemTemplateElement)
  +    {
  +		return ((org.apache.xalan.templates.ElemTemplateElement)owner).getDOMBackPointer();
  +    }
  +    return null;
  +
  +  }
  +  
  +  /**
  +   * Get the first non-Expression parent of this node.
  +   * @return null or first ancestor that is not an Expression.
  +   */
  +  protected ExpressionNode getExpressionOwner(ExpressionNode ex)
  +  {
  +  	ExpressionNode parent = ex.exprGetParent();
  +  	while((null != parent) && (parent instanceof Expression))
  +  		parent = parent.exprGetParent();
  +  	return parent;
  +  }
  +
  +
   
     /**
      * Create an XPathException object that holds
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message