com.jclark.xsl.sax2
Class OutputMethodDefaulter

java.lang.Object
  extended by com.jclark.xsl.sax2.OutputMethodDefaulter
All Implemented Interfaces:
CommentHandler, RawCharactersHandler, org.xml.sax.ContentHandler

public class OutputMethodDefaulter
extends java.lang.Object
implements org.xml.sax.ContentHandler, CommentHandler, RawCharactersHandler

automagically decides to use the html output method if the first start element name is "html" in no namespace

Recieves SAX parse events from a ResultBase, till it gets a look at the root element's name.

Tells the ResultBase that had been sending it SAX parse events what this has learned. The result base will switch to an appropriate ContentHandler. This then sends any events it has queued up while waiting to see the root element name, then is never used again during the transform.


Nested Class Summary
(package private) static class OutputMethodDefaulter.CharactersEvent
           
(package private) static class OutputMethodDefaulter.CommentEvent
           
(package private) static class OutputMethodDefaulter.Event
           
(package private) static class OutputMethodDefaulter.IgnorableWhitespaceEvent
           
(package private) static class OutputMethodDefaulter.ProcessingInstructionEvent
           
(package private) static class OutputMethodDefaulter.RawCharactersEvent
           
 
Constructor Summary
OutputMethodDefaulter(ResultBase result, OutputMethod outputMethod)
          Construct with the guy who's gonna be sending us events and whatever the stylesheet's told us about the output parameters
 
Method Summary
 void characters(char[] buf, int off, int len)
           
 void comment(java.lang.String content)
          recieve notification that a comment has been encountered in the parse
 void endDocument()
          receive notice of doc's end
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          receive notice of an element's end ...
 void endPrefixMapping(java.lang.String prefix)
           
 void ignorableWhitespace(char[] buf, int off, int len)
           
 void processingInstruction(java.lang.String target, java.lang.String content)
           
 void rawCharacters(java.lang.String chars)
           
 void setDocumentLocator(org.xml.sax.Locator loc)
           
 void skippedEntity(java.lang.String name)
           
 void startDocument()
          receive notice of doc's start
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          the first start element, if it's "html" and in no namespace, then we switch to an html contentHandler -- yucchh
 void startPrefixMapping(java.lang.String prefix, java.lang.String namespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputMethodDefaulter

OutputMethodDefaulter(ResultBase result,
                      OutputMethod outputMethod)
Construct with the guy who's gonna be sending us events and whatever the stylesheet's told us about the output parameters

Method Detail

startDocument

public void startDocument()
receive notice of doc's start

Specified by:
startDocument in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
receive notice of doc's end

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
the first start element, if it's "html" and in no namespace, then we switch to an html contentHandler -- yucchh

Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
receive notice of an element's end ... this should never happen, because we should have routed all events to another ContentHandler upon getting the first startElement()

Specified by:
endElement in interface org.xml.sax.ContentHandler

characters

public void characters(char[] buf,
                       int off,
                       int len)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] buf,
                                int off,
                                int len)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String content)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

setDocumentLocator

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

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String namespace)
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

comment

public void comment(java.lang.String content)
Description copied from interface: CommentHandler
recieve notification that a comment has been encountered in the parse

Specified by:
comment in interface CommentHandler

rawCharacters

public void rawCharacters(java.lang.String chars)
Specified by:
rawCharacters in interface RawCharactersHandler