com.sun.org.apache.xpath.internal.objects.XObject.str()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中com.sun.org.apache.xpath.internal.objects.XObject.str()方法的一些代码示例,展示了XObject.str()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XObject.str()方法的具体详情如下:
包路径:com.sun.org.apache.xpath.internal.objects.XObject
类名称:XObject
方法名:str

XObject.str介绍

[英]Cast result object to a string.
[中]将结果对象强制转换为字符串。

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * Return the string representation of the object
 *
 *
 * @return the string representation of the object
 */
public String toString()
{
 return str();
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Return the string representation of the object
 *
 *
 * @return the string representation of the object
 */
public String toString()
{
 return str();
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Cast result object to a string.
 *
 *
 * NEEDSDOC @param fsb
 * @return The string this wraps or the empty string if null
 */
public void appendToFsb(com.sun.org.apache.xml.internal.utils.FastStringBuffer fsb)
{
 fsb.append(str());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * Cast result object to a string.
 *
 *
 * NEEDSDOC @param fsb
 * @return The string this wraps or the empty string if null
 */
public void appendToFsb(com.sun.org.apache.xml.internal.utils.FastStringBuffer fsb)
{
 fsb.append(str());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
  * 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();

  // Add this check for JDK consistency for empty strings.
  if (s1.length() == 0 && s2.length() == 0)
   return XBoolean.S_TRUE;

  int index = s1.indexOf(s2);

  return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
 }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
  * 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();

  // Add this check for JDK consistency for empty strings.
  if (s1.length() == 0 && s2.length() == 0)
   return XBoolean.S_TRUE;

  int index = s1.indexOf(s2);

  return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
  * 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));
 }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
  * 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));
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * 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());
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Cast result object to a string.
 *
 * @return The string this wraps or the empty string if null
 */
public XMLString xstr()
{
 return XMLStringFactoryImpl.getFactory().newstr(str());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * Cast result object to a string.
 *
 * @return The string this wraps or the empty string if null
 */
public XMLString xstr()
{
 return XMLStringFactoryImpl.getFactory().newstr(str());
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Cast result object to a result tree fragment.
 *
 * @param support XPath context to use for the conversion
 *
 * @return the objec as a result tree fragment.
 */
public int rtf(XPathContext support)
{
 int result = rtf();
 if (DTM.NULL == result)
 {
  DTM frag = support.createDocumentFragment();
  // %OPT%
  frag.appendTextChild(str());
  result = frag.getDocument();
 }
 return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * Cast result object to a result tree fragment.
 *
 * @param support XPath context to use for the conversion
 *
 * @return the objec as a result tree fragment.
 */
public int rtf(XPathContext support)
{
 int result = rtf();
 if (DTM.NULL == result)
 {
  DTM frag = support.createDocumentFragment();
  // %OPT%
  frag.appendTextChild(str());
  result = frag.getDocument();
 }
 return result;
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * For support of literal objects in xpaths.
 *
 * @param xctxt The XPath execution context.
 *
 * @return the result of executing the select expression
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt)
    throws javax.xml.transform.TransformerException
{
  XObject m_selected;
  m_selected = ((Expression)m_obj).execute(xctxt);
  m_selected.allowDetachToRelease(m_allowRelease);
  if (m_selected.getType() == CLASS_STRING)
   return m_selected;
  else
   return new XString(m_selected.str());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * For support of literal objects in xpaths.
 *
 * @param xctxt The XPath execution context.
 *
 * @return the result of executing the select expression
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt)
    throws javax.xml.transform.TransformerException
{
  XObject m_selected;
  m_selected = ((Expression)m_obj).execute(xctxt);
  m_selected.allowDetachToRelease(m_allowRelease);
  if (m_selected.getType() == CLASS_STRING)
   return m_selected;
  else
   return new XString(m_selected.str());
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
   * The value of this string result.
   * @exception XPathException
   *   TYPE_ERR: raised if <code>resultType</code> is not 
   *   <code>STRING_TYPE</code>.
   * 
   * @see org.w3c.dom.xpath.XPathResult#getStringValue()
   */
  public String getStringValue() throws XPathException {
    if (getResultType() != STRING_TYPE) {
      String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()});		
      throw new XPathException(XPathException.TYPE_ERR,fmsg);
//        "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string."
    } else {
      try {
        return m_resultObj.str();
      } catch (Exception e) {
        // Type check above should prevent this exception from occurring.
        throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
      }
    }
  }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
   * The value of this string result.
   * @exception XPathException
   *   TYPE_ERR: raised if <code>resultType</code> is not 
   *   <code>STRING_TYPE</code>.
   * 
   * @see org.w3c.dom.xpath.XPathResult#getStringValue()
   */
  public String getStringValue() throws XPathException {
    if (getResultType() != STRING_TYPE) {
      String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()});		
      throw new XPathException(XPathException.TYPE_ERR,fmsg);
//        "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string."
    } else {
      try {
        return m_resultObj.str();
      } catch (Exception e) {
        // Type check above should prevent this exception from occurring.
        throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
      }
    }
  }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
  * 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);
 }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
  * 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);
 }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Cast result object to a result tree fragment.
 *
 * @param support XPath context to use for the conversion
 *
 * @return the objec as a result tree fragment.
 */
public DocumentFragment rtree(XPathContext support)
{
 DocumentFragment docFrag = null;
 int result = rtf();
 if (DTM.NULL == result)
 {
  DTM frag = support.createDocumentFragment();
  // %OPT%
  frag.appendTextChild(str());
  docFrag = (DocumentFragment)frag.getNode(frag.getDocument());
 }
 else
 {
  DTM frag = support.getDTM(result);
  docFrag = (DocumentFragment)frag.getNode(frag.getDocument());
 }
 return docFrag;
}

相关文章