类com.sun.org.apache.xml.internal.utils.XMLString源码实例Demo

下面列出了怎么用com.sun.org.apache.xml.internal.utils.XMLString的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TencentKona-8   文件: FunctionDef1Arg.java
/**
 * 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();
}
 
源代码2 项目: openjdk-jdk8u-backup   文件: FunctionDef1Arg.java
/**
 * 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();
}
 
源代码3 项目: jdk1.8-source-analysis   文件: XStringForFSB.java
/**
 * 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());
}
 
源代码4 项目: jdk8u60   文件: XStringForFSB.java
/**
 * 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());
}
 
源代码5 项目: openjdk-jdk9   文件: FuncSum.java
/**
 * 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);
}
 
源代码6 项目: TencentKona-8   文件: XStringForFSB.java
/**
 * 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);
  }
}
 
源代码7 项目: Bytecoder   文件: FunctionDef1Arg.java
/**
 * 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();
}
 
源代码8 项目: openjdk-8   文件: XStringForFSB.java
/**
 * 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());
}
 
源代码9 项目: jdk8u60   文件: FuncSum.java
/**
 * 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);
}
 
源代码10 项目: openjdk-jdk8u   文件: XPathContext.java
/**
 * 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();
}
 
源代码11 项目: jdk1.8-source-analysis   文件: DOM2DTM.java
/**
 * 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);
                }
        }
  }
}
 
源代码12 项目: openjdk-jdk9   文件: XRTreeFrag.java
/**
 * 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();
}
 
源代码13 项目: openjdk-jdk9   文件: XStringForFSB.java
/**
 * 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(XMLString obj2)
{

  if (this == obj2)
  {
    return true;
  }

  int n = m_length;

  if (n == obj2.length())
  {
    FastStringBuffer fsb = fsb();
    int i = m_start;
    int j = 0;

    while (n-- != 0)
    {
      if (fsb.charAt(i) != obj2.charAt(j))
      {
        return false;
      }

      i++;
      j++;
    }

    return true;
  }

  return false;
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: XRTreeFrag.java
/**
 * 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();
}
 
源代码15 项目: openjdk-jdk8u   文件: XStringForFSB.java
/**
 * 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(XMLString obj2)
{

  if (this == obj2)
  {
    return true;
  }

  int n = m_length;

  if (n == obj2.length())
  {
    FastStringBuffer fsb = fsb();
    int i = m_start;
    int j = 0;

    while (n-- != 0)
    {
      if (fsb.charAt(i) != obj2.charAt(j))
      {
        return false;
      }

      i++;
      j++;
    }

    return true;
  }

  return false;
}
 
源代码16 项目: openjdk-8   文件: XStringForFSB.java
/**
 * 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;
}
 
源代码17 项目: JDKSourceCode1.8   文件: XString.java
/**
 * 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;
}
 
源代码18 项目: JDKSourceCode1.8   文件: FuncSubstringAfter.java
/**
 * 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());
}
 
源代码19 项目: hottub   文件: XString.java
/**
   * 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;
}
 
源代码20 项目: openjdk-8-source   文件: XRTreeFrag.java
/**
 * 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();
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: XStringForFSB.java
/**
 * 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(XMLString obj2)
{

  if (this == obj2)
  {
    return true;
  }

  int n = m_length;

  if (n == obj2.length())
  {
    FastStringBuffer fsb = fsb();
    int i = m_start;
    int j = 0;

    while (n-- != 0)
    {
      if (fsb.charAt(i) != obj2.charAt(j))
      {
        return false;
      }

      i++;
      j++;
    }

    return true;
  }

  return false;
}
 
源代码22 项目: hottub   文件: XString.java
/**
 * 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;
}
 
源代码23 项目: openjdk-jdk9   文件: XStringForFSB.java
/**
 * 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;
}
 
源代码24 项目: openjdk-8   文件: FuncSubstringAfter.java
/**
 * 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());
}
 
源代码25 项目: openjdk-8   文件: XStringForFSB.java
/**
 * 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;
}
 
源代码26 项目: jdk8u60   文件: AdaptiveResultTreeImpl.java
public XMLString getStringValue(int nodeHandle)
{
    if (_dom != null) {
        return _dom.getStringValue(nodeHandle);
    }
    else {
        return super.getStringValue(nodeHandle);
    }
}
 
源代码27 项目: hottub   文件: XStringForFSB.java
/**
 * 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;
}
 
源代码28 项目: TencentKona-8   文件: DOM2DTM.java
/**
 * 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);
                }
        }
  }
}
 
源代码29 项目: openjdk-8   文件: XStringForFSB.java
/**
 * 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;
}
 
源代码30 项目: openjdk-jdk8u   文件: XNodeSet.java
/**
 * 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;
  }
}
 
 类方法
 同包方法