Class PrettyPrinter

java.lang.Object
net.ontopia.xml.PrettyPrinter
All Implemented Interfaces:
ContentHandler

public class PrettyPrinter extends Object implements ContentHandler
INTERNAL: SAX document handler that writes pretty-printed XML to a Writer.
  • Field Details

    • writer

      protected Writer writer
    • encoding

      protected String encoding
    • subelements

      protected boolean[] subelements
    • startline

      protected char[] startline
    • offset

      protected int offset
    • level

      protected int level
    • encodeCharsFrom

      protected int encodeCharsFrom
    • dropControlChars

      protected boolean dropControlChars
  • Constructor Details

  • Method Details

    • startDocument

      public void startDocument()
      Specified by:
      startDocument in interface ContentHandler
    • startElement

      public void startElement(String uri, String localName, String qName, Attributes atts)
      Specified by:
      startElement in interface ContentHandler
    • endElement

      public void endElement(String uri, String localName, String qName)
      Specified by:
      endElement in interface ContentHandler
    • characters

      public void characters(char[] ch, int start, int length)
      Specified by:
      characters in interface ContentHandler
    • ignorableWhitespace

      public void ignorableWhitespace(char[] ch, int start, int length)
      Specified by:
      ignorableWhitespace in interface ContentHandler
    • processingInstruction

      public void processingInstruction(String target, String data)
      Specified by:
      processingInstruction in interface ContentHandler
    • endDocument

      public void endDocument()
      Specified by:
      endDocument in interface ContentHandler
    • setDocumentLocator

      public void setDocumentLocator(Locator locator)
      Specified by:
      setDocumentLocator in interface ContentHandler
    • setEncodeCharactersFrom

      public void setEncodeCharactersFrom(int charnumber)
      INTERNAL: Encodes element content as decimal character entitites for characters from the given character number.
    • setDropControlCharacters

      public void setDropControlCharacters(boolean dropControlChars)
      INTERNAL: If this property is true control characters are being dropped from the resulting document.
    • addUnescaped

      public void addUnescaped(String content)
      INTERNAL: Add given text unmodified and unescaped to the output. BEWARE: This makes it possible (even easy) to produce output that is not well-formed.
    • write

      protected void write(Writer writer, String s)
    • write

      protected void write(Writer writer, char c)
    • write

      protected void write(Writer writer, char[] c, int off, int len)
    • flush

      protected void flush(Writer writer)
    • indent

      protected void indent()
    • escapeAttrValue

      protected void escapeAttrValue(String attrval, Writer writer)
    • makeStartLineBuffer

      protected void makeStartLineBuffer(int size)
    • makeSubelements

      protected void makeSubelements(int size)
    • startPrefixMapping

      public void startPrefixMapping(String prefix, String uri) throws SAXException
      Specified by:
      startPrefixMapping in interface ContentHandler
      Throws:
      SAXException
    • endPrefixMapping

      public void endPrefixMapping(String prefix) throws SAXException
      Specified by:
      endPrefixMapping in interface ContentHandler
      Throws:
      SAXException
    • skippedEntity

      public void skippedEntity(String name) throws SAXException
      Specified by:
      skippedEntity in interface ContentHandler
      Throws:
      SAXException