com.aliasi.xml
Class SAXWriterFilter

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.aliasi.xml.SimpleElementHandler
          extended by com.aliasi.xml.SAXFilterHandler
              extended by com.aliasi.xml.SAXWriterFilter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

Deprecated. Not used anywhere.

@Deprecated
public class SAXWriterFilter
extends SAXFilterHandler

A SAXWriterFilter handles SAX events and writes a character-based representation to a specified output stream in the specified character encoding and also passes them to a contained handler. The methods provided are exactly the same as those for a SAXWriter.

All events are passed to the contained handler, and this contained handler may be specified at construction time or through the filter method SAXFilterHandler.setHandler(DefaultHandler).

Note that a DTD specified by setDTDString(String) is not passed to the contained handler, but is only written to the output stream.

Since:
LingPipe2.0
Version:
3.8
Author:
Bob Carpenter

Field Summary
 
Fields inherited from class com.aliasi.xml.SAXFilterHandler
mHandler
 
Fields inherited from class com.aliasi.xml.SimpleElementHandler
CDATA_ATTS_TYPE, EMPTY_ATTS, NO_OP_DEFAULT_HANDLER
 
Constructor Summary
SAXWriterFilter()
          Deprecated. Construct a SAX writer that does not have an output stream, character set, or contained handler specified.
SAXWriterFilter(OutputStream out, String charsetName, DefaultHandler handler)
          Deprecated. Construct a SAX writer that writes to the specified output stream using the specified character set.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Deprecated. Prints the characters in the specified range.
 void endDocument()
          Deprecated. Flushes the underlying character writers output to the output stream, trapping all exceptions.
 void endElement(String namespaceURI, String localName, String qName)
          Deprecated. Prints the end element, using the qualified name.
 void endPrefixMapping(String prefix)
          Deprecated. Handles the declaration of a namespace mapping from a specified URI to its identifying prefix.
 void ignorableWhitespace(char[] ch, int start, int length)
          Deprecated. Does not print ignorable whitespace, nor does it send the event to the contained handler.
 void processingInstruction(String target, String data)
          Deprecated. Print a representation of the proecssing instruction.
 void setDTDString(String dtdString)
          Deprecated. Sets the DTD to be written by this writer to the specified value.
 void setOutputStream(OutputStream out, String charsetName)
          Deprecated. Sets the output stream to which the XML is written, and the character set which is used to encode characters.
 void startDocument()
          Deprecated. Prints the XML declaration, and DTD declaration if any.
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Deprecated. Prints the start element, using the qualified name, and sorting the attributes using the underlying string ordering.
 void startPrefixMapping(String prefix, String uri)
          Deprecated. Handles the declaration of a namespace mapping from a specified URI to its identifying prefix.
 
Methods inherited from class com.aliasi.xml.SAXFilterHandler
error, fatalError, notationDecl, resolveEntity, setDocumentLocator, setHandler, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class com.aliasi.xml.SimpleElementHandler
addSimpleAttribute, characters, characters, characters, characters, createAttributes, createAttributes, createAttributes, createAttributes, createAttributes, createAttributes, endSimpleElement, endSimpleElement, startEndSimpleElement, startEndSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement, startSimpleElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXWriterFilter

public SAXWriterFilter(OutputStream out,
                       String charsetName,
                       DefaultHandler handler)
                throws UnsupportedEncodingException
Deprecated. 
Construct a SAX writer that writes to the specified output stream using the specified character set. See setOutputStream(OutputStream,String) for details on the management of the output stream and character set.

Parameters:
out - Output stream to which bytes are written.
charsetName - Name of character encoding used to write output.
handler - Contained handler for this filter.
Throws:
UnsupportedEncodingException - If the character set is not supported.

SAXWriterFilter

public SAXWriterFilter()
Deprecated. 
Construct a SAX writer that does not have an output stream, character set, or contained handler specified. These must be set through setOutputStream(OutputStream,String) or an illegal state exception will be thrown. The contained handler will default to a no-op handler, but may be set by SAXFilterHandler.setHandler(DefaultHandler).

Method Detail

setDTDString

public void setDTDString(String dtdString)
Deprecated. 
Sets the DTD to be written by this writer to the specified value. There is no error checking on its well-formedness, and it is not wrapped in any way other than being printed on its own line; this allows arbitrary DTDs to be written.

Parameters:
dtdString - String to write after the XML declaration as the DTD declaration.

setOutputStream

public final void setOutputStream(OutputStream out,
                                  String charsetName)
                           throws UnsupportedEncodingException
Deprecated. 
Sets the output stream to which the XML is written, and the character set which is used to encode characters. Before writing a document, the output stream and character set must be set by the constructor or by this method. The output stream is not closed after an XML document is written, but all output to the stream will be produced and does not need to be otherwise flushed.

Parameters:
out - Output stream to which encoded characters are written.
charsetName - Character set to use for encoding characters.
Throws:
UnsupportedEncodingException - If the character set is not supported by the Java runtime.

startDocument

public void startDocument()
                   throws SAXException
Deprecated. 
Prints the XML declaration, and DTD declaration if any.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class SAXFilterHandler
Throws:
SAXException - if the contained hanlder throws a SAX exception.

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Deprecated. 
Handles the declaration of a namespace mapping from a specified URI to its identifying prefix. The mapping is buffered and then flushed and printed as an attribute during the next start-element call.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class SAXFilterHandler
Parameters:
prefix - The namespace prefix being declared..
uri - The namespace URI mapped to prefix.
Throws:
SAXException - If the contained handler throws an exception on the specified prefix mapping.

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Deprecated. 
Handles the declaration of a namespace mapping from a specified URI to its identifying prefix. The mapping is buffered and then flushed and printed as an attribute during the next start-element call.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class SAXFilterHandler
Parameters:
prefix - The namespace prefix being declared..
Throws:
SAXException - If the contained handler throws an exception on the specified prefix.

endDocument

public void endDocument()
                 throws SAXException
Deprecated. 
Flushes the underlying character writers output to the output stream, trapping all exceptions.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class SAXFilterHandler
Throws:
SAXException - if the contained hanlder throws a SAX exception.

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Deprecated. 
Prints the start element, using the qualified name, and sorting the attributes using the underlying string ordering. Namespace URI and local names are ignored, and qualified name must not be null.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class SAXFilterHandler
Parameters:
namespaceURI - The URI of the namespace for this element.
localName - The local name (without prefix) for this element.
qName - The qualified name (with prefix, if any) for this element.
atts - The attributes for this element.
Throws:
SAXException - if the contained hanlder throws a SAX exception.

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Deprecated. 
Prints the end element, using the qualified name. Namespace URI and local name parameters are ignored, and the qualified name must not be null

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class SAXFilterHandler
Parameters:
namespaceURI - The URI of the namespace for this element.
localName - The local name (without prefix) for this element.
qName - The qualified name (with prefix, if any) for this element.
Throws:
SAXException - if the contained hanlder throws a SAX exception.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Deprecated. 
Prints the characters in the specified range.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class SAXFilterHandler
Parameters:
ch - Character array from which to draw characters.
start - Index of first character to print.
length - Number of characters to print.
Throws:
SAXException - if the contained hanlder throws a SAX exception.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Deprecated. 
Does not print ignorable whitespace, nor does it send the event to the contained handler.

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class SAXFilterHandler
Parameters:
ch - Character array from which to draw characters.
start - Index of first character to print.
length - Number of characters to print.
Throws:
SAXException - if the contained hanlder throws a SAX exception.

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Deprecated. 
Print a representation of the proecssing instruction. This will be ⟨?Target if there is no data, or * <?Target Data> if there is data.

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class SAXFilterHandler
Parameters:
target - Target of the instruction.
data - Value of the instruction, or null.
Throws:
SAXException - if the contained hanlder throws a SAX exception.