KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xml > internal > utils > XMLString


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: XMLString.java,v 1.4 2004/02/17 04:21:14 minchau Exp $
18  */

19 package com.sun.org.apache.xml.internal.utils;
20
21 import java.util.Locale JavaDoc;
22
23 /**
24  * This class is meant to be an interface to character strings, whether they
25  * be java Strings or <code>com.sun.org.apache.xml.internal.utils.FastStringBuffer</code>s, or
26  * other character data. By using XMLString, character copies can be reduced
27  * in the XML pipeline.
28  */

29 public interface XMLString
30 {
31
32   /**
33    * Directly call the
34    * characters method on the passed ContentHandler for the
35    * string-value. Multiple calls to the
36    * ContentHandler's characters methods may well occur for a single call to
37    * this method.
38    *
39    * @param ch A non-null reference to a ContentHandler.
40    *
41    * @throws org.xml.sax.SAXException
42    */

43   public abstract void dispatchCharactersEvents(org.xml.sax.ContentHandler JavaDoc ch)
44     throws org.xml.sax.SAXException JavaDoc;
45
46   /**
47    * Directly call the
48    * comment method on the passed LexicalHandler for the
49    * string-value.
50    *
51    * @param lh A non-null reference to a LexicalHandler.
52    *
53    * @throws org.xml.sax.SAXException
54    */

55   public abstract void dispatchAsComment(org.xml.sax.ext.LexicalHandler JavaDoc lh)
56     throws org.xml.sax.SAXException JavaDoc;
57     
58   /**
59    * Conditionally trim all leading and trailing whitespace in the specified String.
60    * All strings of white space are
61    * replaced by a single space character (#x20), except spaces after punctuation which
62    * receive double spaces if doublePunctuationSpaces is true.
63    * This function may be useful to a formatter, but to get first class
64    * results, the formatter should probably do it's own white space handling
65    * based on the semantics of the formatting object.
66    *
67    * @param trimHead Trim leading whitespace?
68    * @param trimTail Trim trailing whitespace?
69    * @param doublePunctuationSpaces Use double spaces for punctuation?
70    * @return The trimmed string.
71    */

72   public XMLString fixWhiteSpace(boolean trimHead,
73                                  boolean trimTail,
74                                  boolean doublePunctuationSpaces);
75
76   /**
77    * Returns the length of this string.
78    *
79    * @return the length of the sequence of characters represented by this
80    * object.
81    */

82   public abstract int length();
83
84   /**
85    * Returns the character at the specified index. An index ranges
86    * from <code>0</code> to <code>length() - 1</code>. The first character
87    * of the sequence is at index <code>0</code>, the next at index
88    * <code>1</code>, and so on, as for array indexing.
89    *
90    * @param index the index of the character.
91    * @return the character at the specified index of this string.
92    * The first character is at index <code>0</code>.
93    * @exception IndexOutOfBoundsException if the <code>index</code>
94    * argument is negative or not less than the length of this
95    * string.
96    */

97   public abstract char charAt(int index);
98
99   /**
100    * Copies characters from this string into the destination character
101    * array.
102    *
103    * @param srcBegin index of the first character in the string
104    * to copy.
105    * @param srcEnd index after the last character in the string
106    * to copy.
107    * @param dst the destination array.
108    * @param dstBegin the start offset in the destination array.
109    * @exception IndexOutOfBoundsException If any of the following
110    * is true:
111    * <ul><li><code>srcBegin</code> is negative.
112    * <li><code>srcBegin</code> is greater than <code>srcEnd</code>
113    * <li><code>srcEnd</code> is greater than the length of this
114    * string
115    * <li><code>dstBegin</code> is negative
116    * <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
117    * <code>dst.length</code></ul>
118    * @exception NullPointerException if <code>dst</code> is <code>null</code>
119    */

120   public abstract void getChars(int srcBegin, int srcEnd, char dst[],
121                                 int dstBegin);
122                                 
123   /**
124    * Compares this string to the specified object.
125    * The result is <code>true</code> if and only if the argument is not
126    * <code>null</code> and is a <code>String</code> object that represents
127    * the same sequence of characters as this object.
128    *
129    * @param anObject the object to compare this <code>String</code>
130    * against.
131    * @return <code>true</code> if the <code>String </code>are equal;
132    * <code>false</code> otherwise.
133    * @see java.lang.String#compareTo(java.lang.String)
134    * @see java.lang.String#equalsIgnoreCase(java.lang.String)
135    */

136   public abstract boolean equals(XMLString anObject);
137
138
139   /**
140    * Compares this string to the specified object.
141    * The result is <code>true</code> if and only if the argument is not
142    * <code>null</code> and is a <code>String</code> object that represents
143    * the same sequence of characters as this object.
144    *
145    * @param anObject the object to compare this <code>String</code>
146    * against.
147    * @return <code>true</code> if the <code>String </code>are equal;
148    * <code>false</code> otherwise.
149    * @see java.lang.String#compareTo(java.lang.String)
150    * @see java.lang.String#equalsIgnoreCase(java.lang.String)
151    */

152   public abstract boolean equals(Object JavaDoc anObject);
153
154   /**
155    * Compares this <code>String</code> to another <code>String</code>,
156    * ignoring case considerations. Two strings are considered equal
157    * ignoring case if they are of the same length, and corresponding
158    * characters in the two strings are equal ignoring case.
159    *
160    * @param anotherString the <code>String</code> to compare this
161    * <code>String</code> against.
162    * @return <code>true</code> if the argument is not <code>null</code>
163    * and the <code>String</code>s are equal,
164    * ignoring case; <code>false</code> otherwise.
165    * @see #equals(Object)
166    * @see java.lang.Character#toLowerCase(char)
167    * @see java.lang.Character#toUpperCase(char)
168    */

169   public abstract boolean equalsIgnoreCase(String JavaDoc anotherString);
170
171   /**
172    * Compares two strings lexicographically.
173    *
174    * @param anotherString the <code>String</code> to be compared.
175    * @return the value <code>0</code> if the argument string is equal to
176    * this string; a value less than <code>0</code> if this string
177    * is lexicographically less than the string argument; and a
178    * value greater than <code>0</code> if this string is
179    * lexicographically greater than the string argument.
180    * @exception java.lang.NullPointerException if <code>anotherString</code>
181    * is <code>null</code>.
182    */

183   public abstract int compareTo(XMLString anotherString);
184
185   /**
186    * Compares two strings lexicographically, ignoring case considerations.
187    * This method returns an integer whose sign is that of
188    * <code>this.toUpperCase().toLowerCase().compareTo(
189    * str.toUpperCase().toLowerCase())</code>.
190    * <p>
191    * Note that this method does <em>not</em> take locale into account,
192    * and will result in an unsatisfactory ordering for certain locales.
193    * The java.text package provides <em>collators</em> to allow
194    * locale-sensitive ordering.
195    *
196    * @param str the <code>String</code> to be compared.
197    * @return a negative integer, zero, or a positive integer as the
198    * the specified String is greater than, equal to, or less
199    * than this String, ignoring case considerations.
200    * @see java.text.Collator#compare(String, String)
201    * @since 1.2
202    */

203   public abstract int compareToIgnoreCase(XMLString str);
204
205   /**
206    * Tests if this string starts with the specified prefix beginning
207    * a specified index.
208    *
209    * @param prefix the prefix.
210    * @param toffset where to begin looking in the string.
211    * @return <code>true</code> if the character sequence represented by the
212    * argument is a prefix of the substring of this object starting
213    * at index <code>toffset</code>; <code>false</code> otherwise.
214    * The result is <code>false</code> if <code>toffset</code> is
215    * negative or greater than the length of this
216    * <code>String</code> object; otherwise the result is the same
217    * as the result of the expression
218    * <pre>
219    * this.subString(toffset).startsWith(prefix)
220    * </pre>
221    * @exception java.lang.NullPointerException if <code>prefix</code> is
222    * <code>null</code>.
223    */

224   public abstract boolean startsWith(String JavaDoc prefix, int toffset);
225
226   /**
227    * Tests if this string starts with the specified prefix beginning
228    * a specified index.
229    *
230    * @param prefix the prefix.
231    * @param toffset where to begin looking in the string.
232    * @return <code>true</code> if the character sequence represented by the
233    * argument is a prefix of the substring of this object starting
234    * at index <code>toffset</code>; <code>false</code> otherwise.
235    * The result is <code>false</code> if <code>toffset</code> is
236    * negative or greater than the length of this
237    * <code>String</code> object; otherwise the result is the same
238    * as the result of the expression
239    * <pre>
240    * this.subString(toffset).startsWith(prefix)
241    * </pre>
242    * @exception java.lang.NullPointerException if <code>prefix</code> is
243    * <code>null</code>.
244    */

245   public abstract boolean startsWith(XMLString prefix, int toffset);
246
247   /**
248    * Tests if this string starts with the specified prefix.
249    *
250    * @param prefix the prefix.
251    * @return <code>true</code> if the character sequence represented by the
252    * argument is a prefix of the character sequence represented by
253    * this string; <code>false</code> otherwise.
254    * Note also that <code>true</code> will be returned if the
255    * argument is an empty string or is equal to this
256    * <code>String</code> object as determined by the
257    * {@link #equals(Object)} method.
258    * @exception java.lang.NullPointerException if <code>prefix</code> is
259    * <code>null</code>.
260    * @since JDK1. 0
261    */

262   public abstract boolean startsWith(String JavaDoc prefix);
263
264   /**
265    * Tests if this string starts with the specified prefix.
266    *
267    * @param prefix the prefix.
268    * @return <code>true</code> if the character sequence represented by the
269    * argument is a prefix of the character sequence represented by
270    * this string; <code>false</code> otherwise.
271    * Note also that <code>true</code> will be returned if the
272    * argument is an empty string or is equal to this
273    * <code>String</code> object as determined by the
274    * {@link #equals(Object)} method.
275    * @exception java.lang.NullPointerException if <code>prefix</code> is
276    * <code>null</code>.
277    * @since JDK1. 0
278    */

279   public abstract boolean startsWith(XMLString prefix);
280
281   /**
282    * Tests if this string ends with the specified suffix.
283    *
284    * @param suffix the suffix.
285    * @return <code>true</code> if the character sequence represented by the
286    * argument is a suffix of the character sequence represented by
287    * this object; <code>false</code> otherwise. Note that the
288    * result will be <code>true</code> if the argument is the
289    * empty string or is equal to this <code>String</code> object
290    * as determined by the {@link #equals(Object)} method.
291    * @exception java.lang.NullPointerException if <code>suffix</code> is
292    * <code>null</code>.
293    */

294   public abstract boolean endsWith(String JavaDoc suffix);
295
296   /**
297    * Returns a hashcode for this string. The hashcode for a
298    * <code>String</code> object is computed as
299    * <blockquote><pre>
300    * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
301    * </pre></blockquote>
302    * using <code>int</code> arithmetic, where <code>s[i]</code> is the
303    * <i>i</i>th character of the string, <code>n</code> is the length of
304    * the string, and <code>^</code> indicates exponentiation.
305    * (The hash value of the empty string is zero.)
306    *
307    * @return a hash code value for this object.
308    */

309   public abstract int hashCode();
310
311   /**
312    * Returns the index within this string of the first occurrence of the
313    * specified character. If a character with value <code>ch</code> occurs
314    * in the character sequence represented by this <code>String</code>
315    * object, then the index of the first such occurrence is returned --
316    * that is, the smallest value <i>k</i> such that:
317    * <blockquote><pre>
318    * this.charAt(<i>k</i>) == ch
319    * </pre></blockquote>
320    * is <code>true</code>. If no such character occurs in this string,
321    * then <code>-1</code> is returned.
322    *
323    * @param ch a character.
324    * @return the index of the first occurrence of the character in the
325    * character sequence represented by this object, or
326    * <code>-1</code> if the character does not occur.
327    */

328   public abstract int indexOf(int ch);
329
330   /**
331    * Returns the index within this string of the first occurrence of the
332    * specified character, starting the search at the specified index.
333    * <p>
334    * If a character with value <code>ch</code> occurs in the character
335    * sequence represented by this <code>String</code> object at an index
336    * no smaller than <code>fromIndex</code>, then the index of the first
337    * such occurrence is returned--that is, the smallest value <i>k</i>
338    * such that:
339    * <blockquote><pre>
340    * (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
341    * </pre></blockquote>
342    * is true. If no such character occurs in this string at or after
343    * position <code>fromIndex</code>, then <code>-1</code> is returned.
344    * <p>
345    * There is no restriction on the value of <code>fromIndex</code>. If it
346    * is negative, it has the same effect as if it were zero: this entire
347    * string may be searched. If it is greater than the length of this
348    * string, it has the same effect as if it were equal to the length of
349    * this string: <code>-1</code> is returned.
350    *
351    * @param ch a character.
352    * @param fromIndex the index to start the search from.
353    * @return the index of the first occurrence of the character in the
354    * character sequence represented by this object that is greater
355    * than or equal to <code>fromIndex</code>, or <code>-1</code>
356    * if the character does not occur.
357    */

358   public abstract int indexOf(int ch, int fromIndex);
359
360   /**
361    * Returns the index within this string of the last occurrence of the
362    * specified character. That is, the index returned is the largest
363    * value <i>k</i> such that:
364    * <blockquote><pre>
365    * this.charAt(<i>k</i>) == ch
366    * </pre></blockquote>
367    * is true.
368    * The String is searched backwards starting at the last character.
369    *
370    * @param ch a character.
371    * @return the index of the last occurrence of the character in the
372    * character sequence represented by this object, or
373    * <code>-1</code> if the character does not occur.
374    */

375   public abstract int lastIndexOf(int ch);
376
377   /**
378    * Returns the index within this string of the last occurrence of the
379    * specified character, searching backward starting at the specified
380    * index. That is, the index returned is the largest value <i>k</i>
381    * such that:
382    * <blockquote><pre>
383    * this.charAt(k) == ch) && (k <= fromIndex)
384    * </pre></blockquote>
385    * is true.
386    *
387    * @param ch a character.
388    * @param fromIndex the index to start the search from. There is no
389    * restriction on the value of <code>fromIndex</code>. If it is
390    * greater than or equal to the length of this string, it has
391    * the same effect as if it were equal to one less than the
392    * length of this string: this entire string may be searched.
393    * If it is negative, it has the same effect as if it were -1:
394    * -1 is returned.
395    * @return the index of the last occurrence of the character in the
396    * character sequence represented by this object that is less
397    * than or equal to <code>fromIndex</code>, or <code>-1</code>
398    * if the character does not occur before that point.
399    */

400   public abstract int lastIndexOf(int ch, int fromIndex);
401
402   /**
403    * Returns the index within this string of the first occurrence of the
404    * specified substring. The integer returned is the smallest value
405    * <i>k</i> such that:
406    * <blockquote><pre>
407    * this.startsWith(str, <i>k</i>)
408    * </pre></blockquote>
409    * is <code>true</code>.
410    *
411    * @param str any string.
412    * @return if the string argument occurs as a substring within this
413    * object, then the index of the first character of the first
414    * such substring is returned; if it does not occur as a
415    * substring, <code>-1</code> is returned.
416    * @exception java.lang.NullPointerException if <code>str</code> is
417    * <code>null</code>.
418    */

419   public abstract int indexOf(String JavaDoc str);
420
421   /**
422    * Returns the index within this string of the first occurrence of the
423    * specified substring. The integer returned is the smallest value
424    * <i>k</i> such that:
425    * <blockquote><pre>
426    * this.startsWith(str, <i>k</i>)
427    * </pre></blockquote>
428    * is <code>true</code>.
429    *
430    * @param str any string.
431    * @return if the string argument occurs as a substring within this
432    * object, then the index of the first character of the first
433    * such substring is returned; if it does not occur as a
434    * substring, <code>-1</code> is returned.
435    * @exception java.lang.NullPointerException if <code>str</code> is
436    * <code>null</code>.
437    */

438   public abstract int indexOf(XMLString str);
439
440   /**
441    * Returns the index within this string of the first occurrence of the
442    * specified substring, starting at the specified index. The integer
443    * returned is the smallest value <i>k</i> such that:
444    * <blockquote><pre>
445    * this.startsWith(str, <i>k</i>) && (<i>k</i> >= fromIndex)
446    * </pre></blockquote>
447    * is <code>true</code>.
448    * <p>
449    * There is no restriction on the value of <code>fromIndex</code>. If
450    * it is negative, it has the same effect as if it were zero: this entire
451    * string may be searched. If it is greater than the length of this
452    * string, it has the same effect as if it were equal to the length of
453    * this string: <code>-1</code> is returned.
454    *
455    * @param str the substring to search for.
456    * @param fromIndex the index to start the search from.
457    * @return If the string argument occurs as a substring within this
458    * object at a starting index no smaller than
459    * <code>fromIndex</code>, then the index of the first character
460    * of the first such substring is returned. If it does not occur
461    * as a substring starting at <code>fromIndex</code> or beyond,
462    * <code>-1</code> is returned.
463    * @exception java.lang.NullPointerException if <code>str</code> is
464    * <code>null</code>
465    */

466   public abstract int indexOf(String JavaDoc str, int fromIndex);
467
468   /**
469    * Returns the index within this string of the rightmost occurrence
470    * of the specified substring. The rightmost empty string "" is
471    * considered to occur at the index value <code>this.length()</code>.
472    * The returned index is the largest value <i>k</i> such that
473    * <blockquote><pre>
474    * this.startsWith(str, k)
475    * </pre></blockquote>
476    * is true.
477    *
478    * @param str the substring to search for.
479    * @return if the string argument occurs one or more times as a substring
480    * within this object, then the index of the first character of
481    * the last such substring is returned. If it does not occur as
482    * a substring, <code>-1</code> is returned.
483    * @exception java.lang.NullPointerException if <code>str</code> is
484    * <code>null</code>.
485    */

486   public abstract int lastIndexOf(String JavaDoc str);
487
488   /**
489    * Returns the index within this string of the last occurrence of
490    * the specified substring.
491    *
492    * @param str the substring to search for.
493    * @param fromIndex the index to start the search from. There is no
494    * restriction on the value of fromIndex. If it is greater than
495    * the length of this string, it has the same effect as if it
496    * were equal to the length of this string: this entire string
497    * may be searched. If it is negative, it has the same effect
498    * as if it were -1: -1 is returned.
499    * @return If the string argument occurs one or more times as a substring
500    * within this object at a starting index no greater than
501    * <code>fromIndex</code>, then the index of the first character of
502    * the last such substring is returned. If it does not occur as a
503    * substring starting at <code>fromIndex</code> or earlier,
504    * <code>-1</code> is returned.
505    * @exception java.lang.NullPointerException if <code>str</code> is
506    * <code>null</code>.
507    */

508   public abstract int lastIndexOf(String JavaDoc str, int fromIndex);
509
510   /**
511    * Returns a new string that is a substring of this string. The
512    * substring begins with the character at the specified index and
513    * extends to the end of this string. <p>
514    * Examples:
515    * <blockquote><pre>
516    * "unhappy".substring(2) returns "happy"
517    * "Harbison".substring(3) returns "bison"
518    * "emptiness".substring(9) returns "" (an empty string)
519    * </pre></blockquote>
520    *
521    * @param beginIndex the beginning index, inclusive.
522    * @return the specified substring.
523    * @exception IndexOutOfBoundsException if
524    * <code>beginIndex</code> is negative or larger than the
525    * length of this <code>String</code> object.
526    */

527   public abstract XMLString substring(int beginIndex);
528
529   /**
530    * Returns a new string that is a substring of this string. The
531    * substring begins at the specified <code>beginIndex</code> and
532    * extends to the character at index <code>endIndex - 1</code>.
533    * Thus the length of the substring is <code>endIndex-beginIndex</code>.
534    *
535    * @param beginIndex the beginning index, inclusive.
536    * @param endIndex the ending index, exclusive.
537    * @return the specified substring.
538    * @exception IndexOutOfBoundsException if the
539    * <code>beginIndex</code> is negative, or
540    * <code>endIndex</code> is larger than the length of
541    * this <code>String</code> object, or
542    * <code>beginIndex</code> is larger than
543    * <code>endIndex</code>.
544    */

545   public abstract XMLString substring(int beginIndex, int endIndex);
546
547   /**
548    * Concatenates the specified string to the end of this string.
549    *
550    * @param str the <code>String</code> that is concatenated to the end
551    * of this <code>String</code>.
552    * @return a string that represents the concatenation of this object's
553    * characters followed by the string argument's characters.
554    * @exception java.lang.NullPointerException if <code>str</code> is
555    * <code>null</code>.
556    */

557   public abstract XMLString concat(String JavaDoc str);
558
559   /**
560    * Converts all of the characters in this <code>String</code> to lower
561    * case using the rules of the given <code>Locale</code>.
562    *
563    * @param locale use the case transformation rules for this locale
564    * @return the String, converted to lowercase.
565    * @see java.lang.Character#toLowerCase(char)
566    * @see java.lang.String#toUpperCase(Locale)
567    */

568   public abstract XMLString toLowerCase(Locale JavaDoc locale);
569
570   /**
571    * Converts all of the characters in this <code>String</code> to lower
572    * case using the rules of the default locale, which is returned
573    * by <code>Locale.getDefault</code>.
574    * <p>
575    *
576    * @return the string, converted to lowercase.
577    * @see java.lang.Character#toLowerCase(char)
578    * @see java.lang.String#toLowerCase(Locale)
579    */

580   public abstract XMLString toLowerCase();
581
582   /**
583    * Converts all of the characters in this <code>String</code> to upper
584    * case using the rules of the given locale.
585    * @param locale use the case transformation rules for this locale
586    * @return the String, converted to uppercase.
587    * @see java.lang.Character#toUpperCase(char)
588    * @see java.lang.String#toLowerCase(Locale)
589    */

590   public abstract XMLString toUpperCase(Locale JavaDoc locale);
591
592   /**
593    * Converts all of the characters in this <code>String</code> to upper
594    * case using the rules of the default locale, which is returned
595    * by <code>Locale.getDefault</code>.
596    *
597    * <p>
598    * If no character in this string has a different uppercase version,
599    * based on calling the <code>toUpperCase</code> method defined by
600    * <code>Character</code>, then the original string is returned.
601    * <p>
602    * Otherwise, this method creates a new <code>String</code> object
603    * representing a character sequence identical in length to the
604    * character sequence represented by this <code>String</code> object and
605    * with every character equal to the result of applying the method
606    * <code>Character.toUpperCase</code> to the corresponding character of
607    * this <code>String</code> object. <p>
608    * Examples:
609    * <blockquote><pre>
610    * "Fahrvergngen".toUpperCase() returns "FAHRVERGNGEN"
611    * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
612    * </pre></blockquote>
613    *
614    * @return the string, converted to uppercase.
615    * @see java.lang.Character#toUpperCase(char)
616    * @see java.lang.String#toUpperCase(Locale)
617    */

618   public abstract XMLString toUpperCase();
619
620   /**
621    * Removes white space from both ends of this string.
622    * <p>
623    * If this <code>String</code> object represents an empty character
624    * sequence, or the first and last characters of character sequence
625    * represented by this <code>String</code> object both have codes
626    * greater than <code>'&#92;u0020'</code> (the space character), then a
627    * reference to this <code>String</code> object is returned.
628    * <p>
629    * Otherwise, if there is no character with a code greater than
630    * <code>'&#92;u0020'</code> in the string, then a new
631    * <code>String</code> object representing an empty string is created
632    * and returned.
633    * <p>
634    * Otherwise, let <i>k</i> be the index of the first character in the
635    * string whose code is greater than <code>'&#92;u0020'</code>, and let
636    * <i>m</i> be the index of the last character in the string whose code
637    * is greater than <code>'&#92;u0020'</code>. A new <code>String</code>
638    * object is created, representing the substring of this string that
639    * begins with the character at index <i>k</i> and ends with the
640    * character at index <i>m</i>-that is, the result of
641    * <code>this.substring(<i>k</i>,&nbsp;<i>m</i>+1)</code>.
642    * <p>
643    * This method may be used to trim
644    * {@link Character#isSpace(char) whitespace} from the beginning and end
645    * of a string; in fact, it trims all ASCII control characters as well.
646    *
647    * @return this string, with white space removed from the front and end.
648    */

649   public abstract XMLString trim();
650
651   /**
652    * This object (which is already a string!) is itself returned.
653    *
654    * @return the string itself.
655    */

656   public abstract String JavaDoc toString();
657   
658   /**
659    * Tell if this object contains a java String object.
660    *
661    * @return true if this XMLString can return a string without creating one.
662    */

663   public abstract boolean hasString();
664   
665   /**
666    * Convert a string to a double -- Allowed input is in fixed
667    * notation ddd.fff.
668    *
669    * @return A double value representation of the string, or return Double.NaN
670    * if the string can not be converted.
671    */

672   public double toDouble();
673 }
674
Popular Tags