org.compass.core.xml.jdom.converter.support
Class StAXBuilder.IndentRemover

java.lang.Object
  extended by org.compass.core.xml.jdom.converter.support.StAXTextModifier
      extended by org.compass.core.xml.jdom.converter.support.StAXBuilder.IndentRemover
Enclosing class:
StAXBuilder

public static class StAXBuilder.IndentRemover
extends StAXTextModifier


Field Summary
(package private) static StAXBuilder.IndentRemover sInstance
           
 
Constructor Summary
protected StAXBuilder.IndentRemover()
           
 
Method Summary
 boolean allowModificationsAfter(javax.xml.stream.XMLStreamReader r, int eventType)
          Always removes indentation after all start and elements without any further checks; essentially allowing (indentation) white space removal anywhere in the document.
static StAXBuilder.IndentRemover getInstance()
           
 boolean possiblyModifyText(javax.xml.stream.XMLStreamReader r, int prevEvent)
          Enables modifications for so-called "indentation white space", ie. all-whitespace (non-CDATA) text segment that starts with a linefeed character (\n or \r); provided it follows a non-text event (anything other than CDATA, ENTITY_REFERENCE and CHARACTERS; none of which usually should be adjacent to CHARACTERS event, if text coalescing is enabled, and automatic entity expansion is not disabled).
 String textToIncludeBetween(javax.xml.stream.XMLStreamReader r, int prevEvent, int nextEvent, String text)
          If we ever get this far, we will still check that the CHARACTERS event is not immediately followed by another textual event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sInstance

static final StAXBuilder.IndentRemover sInstance
Constructor Detail

StAXBuilder.IndentRemover

protected StAXBuilder.IndentRemover()
Method Detail

getInstance

public static StAXBuilder.IndentRemover getInstance()

allowModificationsAfter

public boolean allowModificationsAfter(javax.xml.stream.XMLStreamReader r,
                                       int eventType)
                                throws javax.xml.stream.XMLStreamException
Always removes indentation after all start and elements without any further checks; essentially allowing (indentation) white space removal anywhere in the document.

Specified by:
allowModificationsAfter in class StAXTextModifier
Parameters:
r - Stream reader that currently points to the event referred.
eventType - Type of the currently pointed to event (either START_ELEMENT or END_ELEMENT)
Throws:
javax.xml.stream.XMLStreamException

possiblyModifyText

public boolean possiblyModifyText(javax.xml.stream.XMLStreamReader r,
                                  int prevEvent)
                           throws javax.xml.stream.XMLStreamException
Enables modifications for so-called "indentation white space", ie. all-whitespace (non-CDATA) text segment that starts with a linefeed character (\n or \r); provided it follows a non-text event (anything other than CDATA, ENTITY_REFERENCE and CHARACTERS; none of which usually should be adjacent to CHARACTERS event, if text coalescing is enabled, and automatic entity expansion is not disabled).

Specified by:
possiblyModifyText in class StAXTextModifier
Parameters:
r - Stream reader that currently points to the CHARACTERS or CDATA event for which method is called.
prevEvent - Type of the event that immediately preceded the current event.
Throws:
javax.xml.stream.XMLStreamException

textToIncludeBetween

public String textToIncludeBetween(javax.xml.stream.XMLStreamReader r,
                                   int prevEvent,
                                   int nextEvent,
                                   String text)
                            throws javax.xml.stream.XMLStreamException
If we ever get this far, we will still check that the CHARACTERS event is not immediately followed by another textual event. If so, we'll just remove the (all white space) text event.

Specified by:
textToIncludeBetween in class StAXTextModifier
Returns:
Text to include in place of a CHARACTERS event; may be the text passed in (no change), null/empty String (remove the text event, usually all white space like indentation), or a modified String.
Throws:
javax.xml.stream.XMLStreamException


Copyright (c) 2004-2009 The Compass Project.