Java Code Examples for com.sun.org.apache.xml.internal.dtm.DTMIterator#getLength()

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTMIterator#getLength() . 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: FuncLast.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 2
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 3
Source File: FuncLast.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 4
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 5
Source File: FuncLast.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 6
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 7
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 8
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 9
Source File: FuncLast.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 10
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 11
Source File: FuncLast.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 12
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 13
Source File: FuncLast.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 14
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 15
Source File: FuncLast.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 16
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 17
Source File: FuncLast.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 18
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }
 
Example 19
Source File: FuncLast.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example 20
Source File: FuncCount.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
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this,
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
        DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
        int i = nl.getLength();
        nl.detach();

    return new XNumber((double) i);
  }