org.openadaptor.simplexml
Class XWhitespace

java.lang.Object
  extended by org.openadaptor.simplexml.XToken
      extended by org.openadaptor.simplexml.XText
          extended by org.openadaptor.simplexml.XWhitespace
All Implemented Interfaces:
ReusableObject

public class XWhitespace
extends XText

XWhitespace - abstract superclass for the various simplexml token classes


Field Summary
 
Fields inherited from class org.openadaptor.simplexml.XText
text, xmlText
 
Fields inherited from class org.openadaptor.simplexml.XToken
AMPERSAND, log, RCARET
 
Constructor Summary
XWhitespace(XScanner scanner)
          Constructs an XWhitespace instance from scanner.
 
Method Summary
 boolean equals(XToken other)
          Returns true if other is XWhitespace, or XText containing whitespace.
 boolean isWhitespace()
          Returns true if the text contains only whitespace.
 boolean matches(XToken other)
          Returns true if other is whitespace.
 java.lang.String toString()
          Returns a string containing the whitespace characters.
 void toWriter(java.io.Writer writer)
          Writes the whitespace text to writer.
 
Methods inherited from class org.openadaptor.simplexml.XText
fromScanner, getText, getTrimmedText, getXmlText, grab, grab, prepareForRelease, printStats, release, setText, textToXml, xmlToText
 
Methods inherited from class org.openadaptor.simplexml.XToken
_grabStringBuffer, _releaseStringBuffer, convertToPlaintext, getClassName, isReleased, printDebug, setReleased, toWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XWhitespace

public XWhitespace(XScanner scanner)
            throws java.io.IOException,
                   XParserException
Constructs an XWhitespace instance from scanner. Constructs an XWhitespace instance from scanner.

Throws:
java.io.IOException
XParserException
Method Detail

isWhitespace

public boolean isWhitespace()
Description copied from class: XText
Returns true if the text contains only whitespace. Null text is treated as whitepace.

Overrides:
isWhitespace in class XText
Returns:
false. May be overridden in subclasses.

toWriter

public void toWriter(java.io.Writer writer)
              throws java.io.IOException
Writes the whitespace text to writer.

Overrides:
toWriter in class XText
Parameters:
writer - Output stream.
Throws:
java.io.IOException

toString

public java.lang.String toString()
Returns a string containing the whitespace characters.

Overrides:
toString in class XText
Returns:
XML encoded version of text.
See Also:
XText.getXmlText()

matches

public boolean matches(XToken other)
Returns true if other is whitespace. Calls equals().

Overrides:
matches in class XText
Parameters:
other - XToken to be compared.
Returns:
true if the receiver equals other.
See Also:
equals(org.openadaptor.simplexml.XToken)

equals

public boolean equals(XToken other)
Returns true if other is XWhitespace, or XText containing whitespace. Whitespace is always equivalent, so always returns true if other is an XWhitespace instance, or an instance of XText containing only whitespace characters, otherwise returns false.

Overrides:
equals in class XText
Parameters:
other - XToken to be compared.
Returns:
true if the receiver equals other.
See Also:
XToken.matches(org.openadaptor.simplexml.XToken)