com.sun.org.apache.xpath.internal.objects.XString Java Examples

The following examples show how to use com.sun.org.apache.xpath.internal.objects.XString. 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: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #2
Source File: FunctionDef1Arg.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the first argument expression that is expected to return a
 * string.  If the argument is null, then get the string value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The string value of the first argument, or the string value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected XMLString getArg0AsString(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{
  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return XString.EMPTYSTRING;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      return dtm.getStringValue(currentNode);
    }

  }
  else
    return m_arg0.execute(xctxt).xstr();
}
 
Example #3
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #4
Source File: FunctionDef1Arg.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the first argument expression that is expected to return a
 * string.  If the argument is null, then get the string value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The string value of the first argument, or the string value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected XMLString getArg0AsString(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{
  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return XString.EMPTYSTRING;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      return dtm.getStringValue(currentNode);
    }

  }
  else
    return m_arg0.execute(xctxt).xstr();
}
 
Example #5
Source File: FuncGenerateId.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
{

  int which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
Example #6
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #7
Source File: FuncGenerateId.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
{

  int which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
Example #8
Source File: FunctionDef1Arg.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the first argument expression that is expected to return a
 * string.  If the argument is null, then get the string value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The string value of the first argument, or the string value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected XMLString getArg0AsString(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{
  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return XString.EMPTYSTRING;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      return dtm.getStringValue(currentNode);
    }

  }
  else
    return m_arg0.execute(xctxt).xstr();
}
 
Example #9
Source File: FuncGenerateId.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 which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
Example #10
Source File: FuncQname.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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
Example #11
Source File: FuncQname.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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
Example #12
Source File: FunctionDef1Arg.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the first argument expression that is expected to return a
 * string.  If the argument is null, then get the string value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The string value of the first argument, or the string value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected XMLString getArg0AsString(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{
  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return XString.EMPTYSTRING;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      return dtm.getStringValue(currentNode);
    }

  }
  else
    return m_arg0.execute(xctxt).xstr();
}
 
Example #13
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #14
Source File: FuncGenerateId.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
{

  int which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
Example #15
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #16
Source File: FunctionDef1Arg.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Execute the first argument expression that is expected to return a
 * string.  If the argument is null, then get the string value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The string value of the first argument, or the string value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected XMLString getArg0AsString(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{
  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return XString.EMPTYSTRING;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      return dtm.getStringValue(currentNode);
    }

  }
  else
    return m_arg0.execute(xctxt).xstr();
}
 
Example #17
Source File: FuncQname.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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
Example #18
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #19
Source File: FuncQname.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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
Example #20
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #21
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #22
Source File: FuncConcat.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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
Example #23
Source File: FuncGenerateId.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
{

  int which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
Example #24
Source File: FuncQname.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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
Example #25
Source File: XPathParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The value of the Literal is the sequence of characters inside
 * the " or ' characters>.
 *
 * Literal  ::=  '"' [^"]* '"'
 * | "'" [^']* "'"
 *
 *
 * @throws javax.xml.transform.TransformerException
 */
protected void Literal() throws javax.xml.transform.TransformerException
{

  int last = m_token.length() - 1;
  char c0 = m_tokenChar;
  char cX = m_token.charAt(last);

  if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
  {

    // Mutate the token to remove the quotes and have the XString object
    // already made.
    int tokenQueuePos = m_queueMark - 1;

    m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);

    Object obj = new XString(m_token.substring(1, last));

    m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);

    // lit = m_token.substring(1, last);
    m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
    m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);

    nextToken();
  }
  else
  {
    error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
          new Object[]{ m_token });  //"Pattern literal ("+m_token+") needs to be quoted!");
  }
}
 
Example #26
Source File: FuncDoclocation.java    From openjdk-8 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 #27
Source File: FuncSubstringBefore.java    From jdk8u60 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
{

  String s1 = m_arg0.execute(xctxt).str();
  String s2 = m_arg1.execute(xctxt).str();
  int index = s1.indexOf(s2);

  return (-1 == index)
         ? XString.EMPTYSTRING : new XString(s1.substring(0, index));
}
 
Example #28
Source File: FuncUnparsedEntityURI.java    From jdk8u60 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
{

  String name = m_arg0.execute(xctxt).str();
  int context = xctxt.getCurrentNode();
  DTM dtm = xctxt.getDTM(context);
  int doc = dtm.getDocument();

  String uri = dtm.getUnparsedEntityURI(name);

  return new XString(uri);
}
 
Example #29
Source File: FuncSubstringBefore.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
{

  String s1 = m_arg0.execute(xctxt).str();
  String s2 = m_arg1.execute(xctxt).str();
  int index = s1.indexOf(s2);

  return (-1 == index)
         ? XString.EMPTYSTRING : new XString(s1.substring(0, index));
}
 
Example #30
Source File: FuncUnparsedEntityURI.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
{

  String name = m_arg0.execute(xctxt).str();
  int context = xctxt.getCurrentNode();
  DTM dtm = xctxt.getDTM(context);
  int doc = dtm.getDocument();

  String uri = dtm.getUnparsedEntityURI(name);

  return new XString(uri);
}