• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XMLString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xml.internal.utils.XMLString的典型用法代码示例。如果您正苦于以下问题:Java XMLString类的具体用法?Java XMLString怎么用?Java XMLString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XMLString类属于com.sun.org.apache.xml.internal.utils包,在下文中一共展示了XMLString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getStringValue

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Get the string-value of a node as a String object
 * (see http://www.w3.org/TR/xpath#data-model
 * for the definition of a node's string-value).
 *
 * @param nodeHandle The node ID.
 *
 * @return A string object that represents the string-value of the given node.
 */
public XMLString getStringValue(int nodeHandle) {
// ###zaj - researching
nodes.readSlot(nodeHandle, gotslot);
int nodetype=gotslot[0] & 0xFF;
String value=null;

switch (nodetype) {
case TEXT_NODE:
case COMMENT_NODE:
case CDATA_SECTION_NODE:
        value= m_char.getString(gotslot[2], gotslot[3]);
        break;
case PROCESSING_INSTRUCTION_NODE:
case ATTRIBUTE_NODE:
case ELEMENT_NODE:
case ENTITY_REFERENCE_NODE:
default:
        break;
}
return m_xsf.newstr( value );

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:DTMDocumentImpl.java


示例2: execute

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * 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 nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
  double sum = 0.0;
  int pos;

  while (DTM.NULL != (pos = nodes.nextNode()))
  {
    DTM dtm = nodes.getDTM(pos);
    XMLString s = dtm.getStringValue(pos);

    if (null != s)
      sum += s.toDouble();
  }
  nodes.detach();

  return new XNumber(sum);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:FuncSum.java


示例3: compareTo

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Compares two strings lexicographically.
 *
 * @param   xstr   the <code>String</code> to be compared.
 *
 * @return  the value <code>0</code> if the argument string is equal to
 *          this string; a value less than <code>0</code> if this string
 *          is lexicographically less than the string argument; and a
 *          value greater than <code>0</code> if this string is
 *          lexicographically greater than the string argument.
 * @exception java.lang.NullPointerException if <code>anotherString</code>
 *          is <code>null</code>.
 */
public int compareTo(XMLString xstr)
{

  int len1 = this.length();
  int len2 = xstr.length();
  int n = Math.min(len1, len2);
  int i = 0;
  int j = 0;

  while (n-- != 0)
  {
    char c1 = this.charAt(i);
    char c2 = xstr.charAt(j);

    if (c1 != c2)
    {
      return c1 - c2;
    }

    i++;
    j++;
  }

  return len1 - len2;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:XString.java


示例4: getArg0AsNumber

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Execute the first argument expression that is expected to return a
 * number.  If the argument is null, then get the number value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The number value of the first argument, or the number 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 double getArg0AsNumber(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return 0;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      XMLString str = dtm.getStringValue(currentNode);
      return str.toDouble();
    }

  }
  else
    return m_arg0.execute(xctxt).num();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:FunctionDef1Arg.java


示例5: equals

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Compares this string to the specified object.
 * The result is <code>true</code> if and only if the argument is not
 * <code>null</code> and is a <code>String</code> object that represents
 * the same sequence of characters as this object.
 *
 * @param   obj2       the object to compare this <code>String</code>
 *                     against.
 *
 * @return  <code>true</code> if the <code>String </code>are equal;
 *          <code>false</code> otherwise.
 * @see     java.lang.String#compareTo(java.lang.String)
 * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
 */
public boolean equals(Object obj2)
{

  if (null == obj2)
    return false;

  if(obj2 instanceof XNumber)
      return obj2.equals(this);

    // In order to handle the 'all' semantics of
    // nodeset comparisons, we always call the
    // nodeset function.
  else if (obj2 instanceof XNodeSet)
    return obj2.equals(this);
  else if (obj2 instanceof XStringForFSB)
    return equals((XMLString) obj2);
  else
    return equals(obj2.toString());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XStringForFSB.java


示例6: substring

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Returns a new string that is a substring of this string. The
 * substring begins at the specified <code>beginIndex</code> and
 * extends to the character at index <code>endIndex - 1</code>.
 * Thus the length of the substring is <code>endIndex-beginIndex</code>.
 *
 * @param      beginIndex   the beginning index, inclusive.
 * @param      endIndex     the ending index, exclusive.
 * @return     the specified substring.
 * @exception  IndexOutOfBoundsException  if the
 *             <code>beginIndex</code> is negative, or
 *             <code>endIndex</code> is larger than the length of
 *             this <code>String</code> object, or
 *             <code>beginIndex</code> is larger than
 *             <code>endIndex</code>.
 */
public XMLString substring(int beginIndex, int endIndex)
{

  int len = endIndex - beginIndex;

  if (len > m_length)
    len = m_length;

  if (len <= 0)
    return XString.EMPTYSTRING;
  else
  {
    int start = m_start + beginIndex;

    return new XStringForFSB(fsb(), start, len);
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XStringForFSB.java


示例7: getArg0AsString

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:FunctionDef1Arg.java


示例8: getStringValue

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
public XMLString getStringValue(int nodeHandle)
{
    if (_dom != null) {
        return _dom.getStringValue(nodeHandle);
    }
    else {
        return super.getStringValue(nodeHandle);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:AdaptiveResultTreeImpl.java


示例9: dispatchCharactersEvents

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Directly call the
 * characters method on the passed ContentHandler for the
 * string-value of the given node (see http://www.w3.org/TR/xpath#data-model
 * for the definition of a node's string-value). Multiple calls to the
 * ContentHandler's characters methods may well occur for a single call to
 * this method.
 *
 * @param nodeHandle The node ID.
 * @param ch A non-null reference to a ContentHandler.
 *
 * @throws org.xml.sax.SAXException
 */
public void dispatchCharactersEvents(
        int nodeHandle, org.xml.sax.ContentHandler ch,
        boolean normalize)
          throws org.xml.sax.SAXException
{
  if(normalize)
  {
    XMLString str = getStringValue(nodeHandle);
    str = str.fixWhiteSpace(true, true, false);
    str.dispatchCharactersEvents(ch);
  }
  else
  {
    int type = getNodeType(nodeHandle);
    Node node = getNode(nodeHandle);
    dispatchNodeData(node, ch, 0);
        // Text coalition -- a DTM text node may represent multiple
        // DOM nodes.
        if(TEXT_NODE == type || CDATA_SECTION_NODE == type)
        {
                while( null != (node=logicalNextDOMTextNode(node)) )
                {
                    dispatchNodeData(node, ch, 0);
                }
        }
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:DOM2DTM.java


示例10: num

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Cast result object to a number.
 *
 * @return The result tree fragment as a number or NaN
 */
public double num()
  throws javax.xml.transform.TransformerException
{

  XMLString s = xstr();

  return s.toDouble();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XRTreeFrag.java


示例11: xstr

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Cast result object to an XMLString.
 *
 * @return The document fragment node data or the empty string.
 */
public XMLString xstr()
{
  if(null == m_xmlStr)
    m_xmlStr = m_DTMXRTreeFrag.getDTM().getStringValue(m_dtmRoot);

  return m_xmlStr;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XRTreeFrag.java


示例12: toDouble

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
   * Convert a string to a double -- Allowed input is in fixed
   * notation ddd.fff.
   *
   * @return A double value representation of the string, or return Double.NaN
   * if the string can not be converted.
   */
  public double toDouble()
  {
    /* XMLCharacterRecognizer.isWhiteSpace(char c) methods treats the following
     * characters as white space characters.
     * ht - horizontal tab, nl - newline , cr - carriage return and sp - space
     * trim() methods by default also takes care of these white space characters
     * So trim() method is used to remove leading and trailing white spaces.
     */
        XMLString s = trim();
        double result = Double.NaN;
        for (int i = 0; i < s.length(); i++)
        {
                char c = s.charAt(i);
    if (c != '-' && c != '.' && ( c < 0X30 || c > 0x39)) {
            // The character is not a '-' or a '.' or a digit
            // then return NaN because something is wrong.
                        return result;
        }
        }
        try
        {
                result = Double.parseDouble(s.toString());
        } catch (NumberFormatException e){}

        return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XString.java


示例13: startsWith

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Tests if this string starts with the specified prefix beginning
 * a specified index.
 *
 * @param   prefix    the prefix.
 * @param   toffset   where to begin looking in the string.
 * @return  <code>true</code> if the character sequence represented by the
 *          argument is a prefix of the substring of this object starting
 *          at index <code>toffset</code>; <code>false</code> otherwise.
 *          The result is <code>false</code> if <code>toffset</code> is
 *          negative or greater than the length of this
 *          <code>String</code> object; otherwise the result is the same
 *          as the result of the expression
 *          <pre>
 *          this.subString(toffset).startsWith(prefix)
 *          </pre>
 * @exception java.lang.NullPointerException if <code>prefix</code> is
 *          <code>null</code>.
 */
public boolean startsWith(XMLString prefix, int toffset)
{

  int to = toffset;
  int tlim = this.length();
  int po = 0;
  int pc = prefix.length();

  // Note: toffset might be near -1>>>1.
  if ((toffset < 0) || (toffset > tlim - pc))
  {
    return false;
  }

  while (--pc >= 0)
  {
    if (this.charAt(to) != prefix.charAt(po))
    {
      return false;
    }

    to++;
    po++;
  }

  return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:XString.java


示例14: execute

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * 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
{

  XMLString s1 = m_arg0.execute(xctxt).xstr();
  XMLString s2 = m_arg1.execute(xctxt).xstr();
  int index = s1.indexOf(s2);

  return (-1 == index)
         ? XString.EMPTYSTRING
         : (XString)s1.substring(index + s2.length());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:FuncSubstringAfter.java


示例15: getStringFromNode

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Get the string conversion from a single node.
 *
 * @param n Node to convert
 *
 * @return the string conversion from a single node.
 */
public XMLString getStringFromNode(int n)
{
  // %OPT%
  // I guess we'll have to get a static instance of the DTM manager...
  if(DTM.NULL != n)
  {
    return m_dtmMgr.getDTM(n).getStringValue(n);
  }
  else
  {
    return com.sun.org.apache.xpath.internal.objects.XString.EMPTYSTRING;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XNodeSet.java


示例16: startsWith

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Tests if this string starts with the specified prefix beginning
 * a specified index.
 *
 * @param   prefix    the prefix.
 * @param   toffset   where to begin looking in the string.
 * @return  <code>true</code> if the character sequence represented by the
 *          argument is a prefix of the substring of this object starting
 *          at index <code>toffset</code>; <code>false</code> otherwise.
 *          The result is <code>false</code> if <code>toffset</code> is
 *          negative or greater than the length of this
 *          <code>String</code> object; otherwise the result is the same
 *          as the result of the expression
 *          <pre>
 *          this.subString(toffset).startsWith(prefix)
 *          </pre>
 * @exception java.lang.NullPointerException if <code>prefix</code> is
 *          <code>null</code>.
 */
public boolean startsWith(XMLString prefix, int toffset)
{

  FastStringBuffer fsb = fsb();
  int to = m_start + toffset;
  int tlim = m_start + m_length;
  int po = 0;
  int pc = prefix.length();

  // Note: toffset might be near -1>>>1.
  if ((toffset < 0) || (toffset > m_length - pc))
  {
    return false;
  }

  while (--pc >= 0)
  {
    if (fsb.charAt(to) != prefix.charAt(po))
    {
      return false;
    }

    to++;
    po++;
  }

  return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:48,代码来源:XStringForFSB.java


示例17: toString

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Get the value of a node as a string.
 * @param n Node to be converted to a string.  May be null.
 * @return value of n as a string, or an empty string if n is null.
 */
public String toString(org.w3c.dom.Node n)
{
  // %REVIEW% You can't get much uglier than this...
  int nodeHandle = getDTMHandleFromNode(n);
  DTM dtm = getDTM(nodeHandle);
  XMLString strVal = dtm.getStringValue(nodeHandle);
  return strVal.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:XPathContext.java


示例18: compareTo

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Compares two strings lexicographically.
 *
 * @param   xstr   the <code>String</code> to be compared.
 *
 * @return  the value <code>0</code> if the argument string is equal to
 *          this string; a value less than <code>0</code> if this string
 *          is lexicographically less than the string argument; and a
 *          value greater than <code>0</code> if this string is
 *          lexicographically greater than the string argument.
 * @exception java.lang.NullPointerException if <code>anotherString</code>
 *          is <code>null</code>.
 */
public int compareTo(XMLString xstr)
{

  int len1 = m_length;
  int len2 = xstr.length();
  int n = Math.min(len1, len2);
  FastStringBuffer fsb = fsb();
  int i = m_start;
  int j = 0;

  while (n-- != 0)
  {
    char c1 = fsb.charAt(i);
    char c2 = xstr.charAt(j);

    if (c1 != c2)
    {
      return c1 - c2;
    }

    i++;
    j++;
  }

  return len1 - len2;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:XStringForFSB.java


示例19: compareToIgnoreCase

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
/**
 * Compares two strings lexicographically, ignoring case considerations.
 * This method returns an integer whose sign is that of
 * <code>this.toUpperCase().toLowerCase().compareTo(
 * str.toUpperCase().toLowerCase())</code>.
 * <p>
 * Note that this method does <em>not</em> take locale into account,
 * and will result in an unsatisfactory ordering for certain locales.
 * The java.text package provides <em>collators</em> to allow
 * locale-sensitive ordering.
 *
 * @param   xstr   the <code>String</code> to be compared.
 *
 * @return  a negative integer, zero, or a positive integer as the
 *          the specified String is greater than, equal to, or less
 *          than this String, ignoring case considerations.
 * @see     java.text.Collator#compare(String, String)
 * @since   1.2
 */
public int compareToIgnoreCase(XMLString xstr)
{

  int len1 = m_length;
  int len2 = xstr.length();
  int n = Math.min(len1, len2);
  FastStringBuffer fsb = fsb();
  int i = m_start;
  int j = 0;

  while (n-- != 0)
  {
    char c1 = Character.toLowerCase(fsb.charAt(i));
    char c2 = Character.toLowerCase(xstr.charAt(j));

    if (c1 != c2)
    {
      return c1 - c2;
    }

    i++;
    j++;
  }

  return len1 - len2;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:XStringForFSB.java


示例20: getStringValue

import com.sun.org.apache.xml.internal.utils.XMLString; //导入依赖的package包/类
public XMLString getStringValue(int nodeHandle)
{
    return new XMLStringDefault(getStringValueX(nodeHandle));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:SimpleResultTreeImpl.java



注:本文中的com.sun.org.apache.xml.internal.utils.XMLString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BalloonTip类代码示例发布时间:2022-05-23
下一篇:
Java Timestamp类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap