com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser. 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: DescendantIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #2
Source File: StepPattern.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #3
Source File: AdaptiveResultTreeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #4
Source File: ChildTestIterator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #5
Source File: StepPattern.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #6
Source File: DescendantIterator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #7
Source File: StepPattern.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #8
Source File: ChildTestIterator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #9
Source File: DescendantIterator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #10
Source File: AdaptiveResultTreeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #11
Source File: DescendantIterator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #12
Source File: ChildTestIterator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #13
Source File: StepPattern.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #14
Source File: StepPattern.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #15
Source File: ChildTestIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #16
Source File: DescendantIterator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #17
Source File: AdaptiveResultTreeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #18
Source File: AdaptiveResultTreeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #19
Source File: StepPattern.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #20
Source File: ChildTestIterator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #21
Source File: DescendantIterator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #22
Source File: AdaptiveResultTreeImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #23
Source File: AdaptiveResultTreeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #24
Source File: DescendantIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #25
Source File: ChildTestIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #26
Source File: StepPattern.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}
 
Example #27
Source File: ChildTestIterator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Create a ChildTestIterator object.
 *
 * @param traverser Traverser that tells how the KeyIterator is to be handled.
 *
 * @throws javax.xml.transform.TransformerException
 */
public ChildTestIterator(DTMAxisTraverser traverser)
{

  super(null);

  m_traverser = traverser;
}
 
Example #28
Source File: DescendantIterator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.
 * <p>WARNING: Do not mutate this class from this function!</p>
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  if(getPredicateCount() > 0)
    return super.asNode(xctxt);

  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);
  DTMAxisTraverser traverser = dtm.getAxisTraverser(m_axis);

  String localName = getLocalName();
  String namespace = getNamespace();
  int what = m_whatToShow;

  // System.out.print(" (DescendantIterator) ");

  // System.out.println("what: ");
  // NodeTest.debugWhatToShow(what);
  if(DTMFilter.SHOW_ALL == what
     || localName == NodeTest.WILD
     || namespace == NodeTest.WILD)
  {
    return traverser.first(current);
  }
  else
  {
    int type = getNodeTypeTest(what);
    int extendedType = dtm.getExpandedTypeID(namespace, localName, type);
    return traverser.first(current, extendedType);
  }
}
 
Example #29
Source File: AdaptiveResultTreeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public DTMAxisTraverser getAxisTraverser(final int axis)
{
    if (_dom != null) {
        return _dom.getAxisTraverser(axis);
    }
    else {
        return super.getAxisTraverser(axis);
    }
}
 
Example #30
Source File: StepPattern.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Execute the match pattern step relative to another step.
 *
 *
 * @param xctxt The XPath runtime context.
 * @param dtm The DTM of the current node.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected final XObject executeRelativePathPattern(
        XPathContext xctxt, DTM dtm, int currentNode)
          throws javax.xml.transform.TransformerException
{

  XObject score = NodeTest.SCORE_NONE;
  int context = currentNode;
  DTMAxisTraverser traverser;

  traverser = dtm.getAxisTraverser(m_axis);

  for (int relative = traverser.first(context); DTM.NULL != relative;
          relative = traverser.next(context, relative))
  {
    try
    {
      xctxt.pushCurrentNode(relative);

      score = execute(xctxt);

      if (score != NodeTest.SCORE_NONE)
        break;
    }
    finally
    {
      xctxt.popCurrentNode();
    }
  }

  return score;
}