Java Code Examples for com.sun.org.apache.xml.internal.dtm.DTM#getFirstChild()

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTM#getFirstChild() . 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: FuncDoclocation.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
{

  int whereNode = getArg0AsNode(xctxt);
  String fileLocation = null;

  if (DTM.NULL != whereNode)
  {
    DTM dtm = xctxt.getDTM(whereNode);

    // %REVIEW%
    if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
    {
      whereNode = dtm.getFirstChild(whereNode);
    }

    if (DTM.NULL != whereNode)
    {
      fileLocation = dtm.getDocumentBaseURI();
    }
  }

  return new XString((null != fileLocation) ? fileLocation : "");
}
 
Example 2
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 3
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 4
Source File: FuncDoclocation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 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
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);

      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
Example 5
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 6
Source File: FuncDoclocation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 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
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);

      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
Example 7
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 8
Source File: FuncDoclocation.java    From JDKSourceCode1.8 with MIT License 5 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
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);

      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
Example 9
Source File: FuncDoclocation.java    From hottub with GNU General Public License v2.0 5 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
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);

      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
Example 10
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 11
Source File: ChildIterator.java    From openjdk-8-source 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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 12
Source File: FuncDoclocation.java    From openjdk-8-source with GNU General Public License v2.0 5 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
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);

      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
Example 13
Source File: ChildIterator.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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 14
Source File: ChildIterator.java    From jdk1.8-source-analysis 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
{
  int current = xctxt.getCurrentNode();

  DTM dtm = xctxt.getDTM(current);

  return dtm.getFirstChild(current);
}
 
Example 15
Source File: DTMChildIterNodeList.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}
 
Example 16
Source File: DTMChildIterNodeList.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}
 
Example 17
Source File: DTMChildIterNodeList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}
 
Example 18
Source File: DTMChildIterNodeList.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}
 
Example 19
Source File: DTMChildIterNodeList.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}
 
Example 20
Source File: DTMChildIterNodeList.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Public constructor: Create a NodeList to support
 * DTMNodeProxy.getChildren().
 *
 * Unfortunately AxisIterators and DTMIterators don't share an API,
 * so I can't use the existing Axis.CHILD iterator. Rather than
 * create Yet Another Class, let's set up a special case of this
 * one.
 *
 * @param parentDTM The DTM containing this node
 * @param parentHandle DTM node-handle integer
 *
 */
public DTMChildIterNodeList(DTM parentDTM,int parentHandle) {
    m_parentDTM=parentDTM;
    m_firstChild=parentDTM.getFirstChild(parentHandle);
}