Xindice API
version 1.1

org.apache.xindice.tools.command
Class StringSerializer

java.lang.Object
  |
  +--org.apache.xindice.tools.command.StringSerializer
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class StringSerializer
extends Object
implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

SAX content handler that produces a string from the SAX events it receives. After calling endDocument(), the string becomes available by calling toString()

Version:
$Revision: 511426 $, $Date: 2007-02-24 22:25:02 -0500 (Sat, 24 Feb 2007) $
Author:
James Bates

Constructor Summary
StringSerializer()
          Creates new StringSerializer.
StringSerializer(String encoding)
          Creates new StringSerializer.
 
Method Summary
 void characters(char[] data, int start, int len)
           
 void comment(char[] data, int start, int len)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(String ns, String localName, String qName)
           
 void endEntity(String entity)
           
 void endPrefixMapping(String prefix)
           
 void ignorableWhitespace(char[] data, int start, int len)
           
 void processingInstruction(String target, String data)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void skippedEntity(String entity)
           
 void startCDATA()
           
 void startDocument()
           
 void startDTD(String docType, String systemID, String publicID)
           
 void startElement(String ns, String localName, String qName, org.xml.sax.Attributes att)
           
 void startEntity(String entity)
           
 void startPrefixMapping(String prefix, String uri)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringSerializer

public StringSerializer()
Creates new StringSerializer. The output encoding is not specified therefore will be treated as "UTF-8".

StringSerializer

public StringSerializer(String encoding)
Creates new StringSerializer.
Parameters:
encoding - The encoding that should be written into the XML declaration for the document. This encoding is not used in any other way: when the resultant string is written to a file, the writing application must still take care to actually write using the correct encoding. If encoding is null, the encoding will be omitted from the XML declaration.
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

comment

public void comment(char[] data,
                    int start,
                    int len)
             throws org.xml.sax.SAXException
Specified by:
comment in interface org.xml.sax.ext.LexicalHandler

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

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

ignorableWhitespace

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

startElement

public void startElement(String ns,
                         String localName,
                         String qName,
                         org.xml.sax.Attributes att)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler

endElement

public void endElement(String ns,
                       String localName,
                       String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(String entity)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

characters

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

setDocumentLocator

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

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

startEntity

public void startEntity(String entity)
                 throws org.xml.sax.SAXException
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler

endEntity

public void endEntity(String entity)
               throws org.xml.sax.SAXException
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler

startDTD

public void startDTD(String docType,
                     String systemID,
                     String publicID)
              throws org.xml.sax.SAXException
Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

toString

public String toString()
Overrides:
toString in class Object

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.