J avolution v3.7 (J2SE 1.5+)

javolution.xml.sax
Class WriterHandler

java.lang.Object
  extended by javolution.xml.sax.WriterHandler
All Implemented Interfaces:
Reusable, ContentHandler

public class WriterHandler
extends java.lang.Object
implements ContentHandler, Reusable

This class generates xml documents from SAX2 events.

Version:
3.1, March 11, 2005
Author:
Jean-Marie Dautelle

Constructor Summary
WriterHandler()
          Default constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receives notification of character data.
 void endDocument()
          Receives notification of the end of a document.
 void endElement(java.lang.CharSequence uri, java.lang.CharSequence localName, java.lang.CharSequence qName)
          Receives notification of the end of an element.
 void endPrefixMapping(java.lang.CharSequence prefix)
          Ends the scope of a prefix-URI mapping.
 void ignorableWhitespace(char[] ch, int start, int length)
          Receives notification of ignorable whitespace in element content.
 void processingInstruction(java.lang.CharSequence target, java.lang.CharSequence data)
          Receives notification of a processing instruction.
 void reset()
          Resets the internal state of this object to its default values.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Receives an object for locating the origin of SAX document events.
 void setIndent(java.lang.CharSequence indent)
          Sets the indentation sequence (default none).
 void setProlog(java.lang.CharSequence prolog)
          Sets the prolog to write at the beginning of the xml document (default none).
 WriterHandler setWriter(java.io.Writer writer)
          Sets the xml document writer.
 void skippedEntity(java.lang.CharSequence name)
          Receives notification of a skipped entity.
 void startDocument()
          Receives notification of the beginning of a document.
 void startElement(java.lang.CharSequence uri, java.lang.CharSequence localName, java.lang.CharSequence qName, Attributes atts)
          Receives notification of the beginning of an element.
 void startPrefixMapping(java.lang.CharSequence prefix, java.lang.CharSequence uri)
          Begins the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriterHandler

public WriterHandler()
Default constructor.

Method Detail

setWriter

public WriterHandler setWriter(java.io.Writer writer)
Sets the xml document writer.

Parameters:
writer - the document writer.
Returns:
this

setIndent

public void setIndent(java.lang.CharSequence indent)
Sets the indentation sequence (default none).

Parameters:
indent - a character sequence containing spaces or a tabulation character.

setProlog

public void setProlog(java.lang.CharSequence prolog)
Sets the prolog to write at the beginning of the xml document (default none).

Parameters:
prolog - the character sequence to be written at the beginning of the document.

reset

public void reset()
Description copied from interface: Reusable
Resets the internal state of this object to its default values.

Specified by:
reset in interface Reusable

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Description copied from interface: ContentHandler
Receives an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface ContentHandler
Parameters:
locator - the document locator.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of the beginning of a document.

Specified by:
startDocument in interface ContentHandler
Throws:
org.xml.sax.SAXException - any SAX exception.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of the end of a document.

Specified by:
endDocument in interface ContentHandler
Throws:
org.xml.sax.SAXException - any SAX exception.

startPrefixMapping

public void startPrefixMapping(java.lang.CharSequence prefix,
                               java.lang.CharSequence uri)
                        throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Begins the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface ContentHandler
Parameters:
prefix - the Namespace prefix being declared.
uri - the namespace URI the prefix is mapped to.
Throws:
org.xml.sax.SAXException - any SAX exception.

endPrefixMapping

public void endPrefixMapping(java.lang.CharSequence prefix)
                      throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Ends the scope of a prefix-URI mapping.

Specified by:
endPrefixMapping in interface ContentHandler
Parameters:
prefix - the prefix that was being mapping.
Throws:
org.xml.sax.SAXException - any SAX exception.

startElement

public void startElement(java.lang.CharSequence uri,
                         java.lang.CharSequence localName,
                         java.lang.CharSequence qName,
                         Attributes atts)
                  throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Parameters:
uri - the namespace URI, or an empty character sequence if the element has no Namespace URI or if namespace processing is not being performed.
localName - the local name (without prefix), or an empty character sequence if namespace processing is not being performed.
qName - the qualified name (with prefix), or an empty character sequence if qualified names are not available.
atts - the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException - any SAX exception.

endElement

public void endElement(java.lang.CharSequence uri,
                       java.lang.CharSequence localName,
                       java.lang.CharSequence qName)
                throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Parameters:
uri - the namespace URI, or an empty character sequence if the element has no Namespace URI or if namespace processing is not being performed.
localName - the local name (without prefix), or an empty character sequence if namespace processing is not being performed.
qName - the qualified XML 1.0 name (with prefix), or an empty character sequence if qualified names are not available.
Throws:
org.xml.sax.SAXException - any SAX exception.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of character data.

Specified by:
characters in interface ContentHandler
Parameters:
ch - the characters from the XML document.
start - the start position in the array.
length - the number of characters to read from the array.
Throws:
org.xml.sax.SAXException - any SAX exception.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of ignorable whitespace in element content.

Specified by:
ignorableWhitespace in interface ContentHandler
Parameters:
ch - the characters from the XML document.
start - the start position in the array.
length - the number of characters to read from the array.
Throws:
org.xml.sax.SAXException - any SAX exception.

processingInstruction

public void processingInstruction(java.lang.CharSequence target,
                                  java.lang.CharSequence data)
                           throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of a processing instruction.

Specified by:
processingInstruction in interface ContentHandler
Parameters:
target - the processing instruction target.
data - the processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target.
Throws:
org.xml.sax.SAXException - any SAX exception.

skippedEntity

public void skippedEntity(java.lang.CharSequence name)
                   throws org.xml.sax.SAXException
Description copied from interface: ContentHandler
Receives notification of a skipped entity.

Specified by:
skippedEntity in interface ContentHandler
Parameters:
name - the name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the character sequence "[dtd]".
Throws:
org.xml.sax.SAXException - any SAX exception.

J avolution v3.7 (J2SE 1.5+)

Copyright © 2006 Javolution.