org.apache.xpath.ExpressionNode Java Examples

The following examples show how to use org.apache.xpath.ExpressionNode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElemTemplateElement.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/** 
 * Set the parent of this node.
 * @param n Must be a ElemTemplateElement.
 */
public void exprSetParent(ExpressionNode n)
{
	// This obviously requires that only a ElemTemplateElement can 
	// parent a node of this type.
	setParentElem((ElemTemplateElement)n);
}
 
Example #2
Source File: RedundentExprEliminator.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Tell if the expr param is contained within an xsl:param.
 */
protected boolean isParam(ExpressionNode expr)
{
	while(null != expr)
	{
		if(expr instanceof ElemTemplateElement)
			break;
		expr = expr.exprGetParent();
	}
	if(null != expr)
	{
		ElemTemplateElement ete = (ElemTemplateElement)expr;
		while(null != ete)
		{
			int type = ete.getXSLToken();
			switch(type)
			{
				case Constants.ELEMNAME_PARAMVARIABLE:
					return true;
				case Constants.ELEMNAME_TEMPLATE:
				case Constants.ELEMNAME_STYLESHEET:
					return false;
			}
			ete = ete.getParentElem();
		}
	}
	return false;
	
}
 
Example #3
Source File: RedundentExprEliminator.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * From an XPath expression component, get the ElemTemplateElement 
 * owner.
 * 
 * @param expr Should be static expression with proper parentage.
 * @return Valid ElemTemplateElement, or throw a runtime exception 
 * if it is not found.
 */
protected ElemTemplateElement getElemFromExpression(Expression expr)
{
	ExpressionNode parent = expr.exprGetParent();
	while(null != parent)
	{
		if(parent instanceof ElemTemplateElement)
			return (ElemTemplateElement)parent;
		parent = parent.exprGetParent();
	}
	throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null));
	// "Programmer's error! expr has no ElemTemplateElement parent!");
}
 
Example #4
Source File: XRTreeFrag.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Create an XRTreeFrag Object.
 *
 */
public XRTreeFrag(int root, XPathContext xctxt, ExpressionNode parent)
{
  super(null);
  exprSetParent(parent);
  initDTM(root, xctxt);    
}
 
Example #5
Source File: FuncExtFunction.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Set the parent node.
 * For an extension function, we also need to set the parent
 * node for all argument expressions.
 * 
 * @param n The parent node
 */
public void exprSetParent(ExpressionNode n) 
{
	
  super.exprSetParent(n);
    
  int nArgs = m_argVec.size();

  for (int i = 0; i < nArgs; i++)
  {
    Expression arg = (Expression) m_argVec.elementAt(i);

    arg.exprSetParent(n);
  }		
}
 
Example #6
Source File: ElemTemplateElement.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Get the ExpressionNode parent of this node.
 */
public ExpressionNode exprGetParent()
{
	return getParentElem();
}
 
Example #7
Source File: ElemTemplateElement.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/** This method returns a child node.  The children are numbered
   from zero, left to right. */
public ExpressionNode exprGetChild(int i)
{
	return (ExpressionNode)item(i);
}
 
Example #8
Source File: ElemTemplateElement.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/** 
 * This method tells the node to add its argument to the node's
 * list of children. 
 * @param n Must be a ElemTemplateElement. 
 */
public void exprAddChild(ExpressionNode n, int i)
{
	appendChild((ElemTemplateElement)n);
}