com.sun.org.apache.xpath.internal.axes.LocPathIterator Java Examples

The following examples show how to use com.sun.org.apache.xpath.internal.axes.LocPathIterator. 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: FuncCurrent.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #2
Source File: FuncCurrent.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #3
Source File: FuncCurrent.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #4
Source File: FuncCurrent.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #5
Source File: FuncCurrent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #6
Source File: FuncCurrent.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #7
Source File: FuncCurrent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #8
Source File: FuncCurrent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #9
Source File: FuncCurrent.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #10
Source File: FuncCurrent.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #11
Source File: FuncCurrent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
Example #12
Source File: XPathImplUtil.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Evaluate an XPath context using the internal XPath engine
 * @param contextItem The XPath context
 * @param xpath The internal XPath engine
 * @return an XObject
 * @throws javax.xml.transform.TransformerException If the expression cannot be evaluated.
 */
XObject eval(Object contextItem, com.sun.org.apache.xpath.internal.XPath xpath)
        throws javax.xml.transform.TransformerException {
    com.sun.org.apache.xpath.internal.XPathContext xpathSupport;
    if (contextItem == null && xpath.getExpression() instanceof LocPathIterator) {
        // the operation must have no dependency on the context that is null
        throw new TransformerException(XSLMessages.createXPATHMessage(
                XPATHErrorResources.ER_CONTEXT_CAN_NOT_BE_NULL,
                new Object[] {}));
    }
    if (functionResolver != null) {
        JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
                functionResolver, featureSecureProcessing, featureManager);
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(jep);
    } else {
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
    }

    xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
    XObject xobj;

    Node contextNode = (Node)contextItem;
    // We always need to have a ContextNode with Xalan XPath implementation
    // To allow simple expression evaluation like 1+1 we are setting
    // dummy Document as Context Node
    if (contextNode == null) {
        xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
    } else {
        xobj = xpath.execute(xpathSupport, contextNode, prefixResolver);
    }

    return xobj;
}
 
Example #13
Source File: XPathImplUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Evaluate an XPath context using the internal XPath engine
 * @param contextItem The XPath context
 * @param xpath The internal XPath engine
 * @return an XObject
 * @throws javax.xml.transform.TransformerException If the expression cannot be evaluated.
 */
XObject eval(Object contextItem, com.sun.org.apache.xpath.internal.XPath xpath)
        throws javax.xml.transform.TransformerException {
    com.sun.org.apache.xpath.internal.XPathContext xpathSupport;
    if (contextItem == null && xpath.getExpression() instanceof LocPathIterator) {
        // the operation must have no dependency on the context that is null
        throw new TransformerException(XSLMessages.createXPATHMessage(
                XPATHErrorResources.ER_CONTEXT_CAN_NOT_BE_NULL,
                new Object[] {}));
    }
    if (functionResolver != null) {
        JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
                functionResolver, featureSecureProcessing, featureManager);
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(jep);
    } else {
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
    }

    xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
    XObject xobj;

    Node contextNode = (Node)contextItem;
    // We always need to have a ContextNode with Xalan XPath implementation
    // To allow simple expression evaluation like 1+1 we are setting
    // dummy Document as Context Node
    if (contextNode == null) {
        xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
    } else {
        xobj = xpath.execute(xpathSupport, contextNode, prefixResolver);
    }

    return xobj;
}
 
Example #14
Source File: XPathVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #15
Source File: XPathVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #16
Source File: XPathVisitor.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #17
Source File: XPathVisitor.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #18
Source File: XPathVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #19
Source File: XPathVisitor.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #20
Source File: XPathVisitor.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #21
Source File: XPathVisitor.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #22
Source File: XPathVisitor.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #23
Source File: XPathVisitor.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}
 
Example #24
Source File: XPathVisitor.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Visit a LocationPath.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param path The LocationPath object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
        return true;
}