fi.iki.hsivonen.xml
Class SaxCompiler

java.lang.Object
  extended by fi.iki.hsivonen.xml.SaxCompiler
All Implemented Interfaces:
ContentHandler

public class SaxCompiler
extends Object
implements ContentHandler

Please refer to http://hsivonen.iki.fi/saxcompiler/

Version:
$Id: SaxCompiler.java,v 1.3 2006/11/18 00:05:24 hsivonen Exp $
Author:
hsivonen

Field Summary
private  int level
           
private  boolean omitRoot
           
private  StringBuilder sb
           
private  int start
           
private  int state
           
private  Writer w
           
 
Constructor Summary
SaxCompiler(Writer w)
          Instantiates a SaxCompiler
 
Method Summary
private  void assertState(int s)
           
private  void assertStateLEQ(int s)
           
 void characters(char[] buf, int offset, int length)
           
 void endDocument()
           
 void endElement(String arg0, String arg1, String arg2)
           
 void endPrefixMapping(String arg0)
           
private  void ensureState()
           
 void ignorableWhitespace(char[] arg0, int arg1, int arg2)
           
static void main(String[] args)
           
 void processingInstruction(String target, String data)
           
 void setDocumentLocator(Locator arg0)
           
 void skippedEntity(String arg0)
           
 void startDocument()
           
 void startElement(String arg0, String arg1, String arg2, Attributes attrs)
           
 void startPrefixMapping(String arg0, String arg1)
           
private  void writeStart()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sb

private StringBuilder sb

w

private Writer w

start

private int start

state

private int state

omitRoot

private boolean omitRoot

level

private int level
Constructor Detail

SaxCompiler

public SaxCompiler(Writer w)
Instantiates a SaxCompiler

Parameters:
w - the Writer to which generated code is written
Method Detail

setDocumentLocator

public void setDocumentLocator(Locator arg0)
Specified by:
setDocumentLocator in interface ContentHandler
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.endDocument()

startPrefixMapping

public void startPrefixMapping(String arg0,
                               String arg1)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(String arg0)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startElement

public void startElement(String arg0,
                         String arg1,
                         String arg2,
                         Attributes attrs)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String arg0,
                       String arg1,
                       String arg2)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] buf,
                       int offset,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] arg0,
                                int arg1,
                                int arg2)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

skippedEntity

public void skippedEntity(String arg0)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.skippedEntity(java.lang.String)

assertState

private void assertState(int s)
                  throws SAXException
Throws:
SAXException

assertStateLEQ

private void assertStateLEQ(int s)
                     throws SAXException
Throws:
SAXException

writeStart

private void writeStart()
                 throws SAXException
Throws:
SAXException

ensureState

private void ensureState()
                  throws SAXException
Throws:
SAXException

main

public static void main(String[] args)