com.faa.sax.util
Class IndentHandler

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.faa.sax.util.IndentHandler

public class IndentHandler
extends org.xml.sax.helpers.DefaultHandler


Constructor Summary
IndentHandler(boolean newTabs, int newIndent, int newFill, int newAttributes, int newLineOffset, boolean newAlignFirstLine, java.io.PrintStream newOut)
          Create a new Indentation Handler that will output the document according with the specified format.
 
Method Summary
 void characters(char[] ch, int start, int length)
          output the characters, taking care of auto-filling and indenting.
 void endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)
          Output the end element tag.
 void error(org.xml.sax.SAXParseException ex)
          Error.
 void fatalError(org.xml.sax.SAXParseException ex)
          Fatal error.
protected  java.lang.String normalize(java.lang.String s)
          Normalize the given string
 void printCharacters()
          print the characters on buffer, taking care of filling and indenting issues
 void processingInstruction(java.lang.String target, java.lang.String data)
          Insert the processing instruction, indented.
 void startDocument()
          Start document.
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
          Print indented start tag and organize attributes accordingly
 void warning(org.xml.sax.SAXParseException ex)
          Warning.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentHandler

public IndentHandler(boolean newTabs,
                     int newIndent,
                     int newFill,
                     int newAttributes,
                     int newLineOffset,
                     boolean newAlignFirstLine,
                     java.io.PrintStream newOut)
Create a new Indentation Handler that will output the document according with the specified format.
Parameters:
newTabs - whether to use tabs for the indentation (or spaces)
newIndent - the amount of indentation characters per level
newFill - auto-fill text at given column. No autofill if 0
newLineOffset - if using autofill, use this as left offset
newAlignWithStart - if auto-filling, align running text with start or end of the tag
newAlignFirstLine - if auto-filling, start of text in the following line
newOut - output stream
See Also:
Indent
Method Detail

startDocument

public void startDocument()
Start document.
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String raw,
                         org.xml.sax.Attributes attrs)
Print indented start tag and organize attributes accordingly
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - the ns part of the qname
local - the local part of the qname
raw - the complete, raw name
atts - the attributes for the element

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local,
                       java.lang.String raw)
Output the end element tag.
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - of the qname
Returns:
local part of the qname

printCharacters

public void printCharacters()
print the characters on buffer, taking care of filling and indenting issues

characters

public void characters(char[] ch,
                       int start,
                       int length)
output the characters, taking care of auto-filling and indenting.
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch[] - the whole stream of characters
Returns:
start start of the valid stream
Throws:
length - number of valid characters in the string

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Insert the processing instruction, indented.
Overrides:
processingInstruction in class org.xml.sax.helpers.DefaultHandler
Parameters:
target - PI Target
Returns:
data PI Data

normalize

protected java.lang.String normalize(java.lang.String s)
Normalize the given string
Parameters:
s - The string to normalize
Returns:
A string with special characters escaped (e.g < is &lt;)

warning

public void warning(org.xml.sax.SAXParseException ex)
Warning.
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler

error

public void error(org.xml.sax.SAXParseException ex)
Error.
Overrides:
error in class org.xml.sax.helpers.DefaultHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.SAXException
Fatal error.
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler