Xindice API
version 1.1

org.apache.xindice.xml.sax
Class SetContentHandler

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.apache.xindice.xml.sax.SetContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SetContentHandler
extends org.xml.sax.helpers.DefaultHandler

Simple ContentHandler that just converts the SAX event stream into a text representation of the document and stores it in the associated resource. The only place this class currently used is in XMLResourceImpl.setContentAsSAX(). Instead of this class, null-transform using TrAX API can be used.

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

Field Summary
protected  Map namespaces
           
protected  StringBuffer newContent
           
protected  org.xmldb.api.modules.XMLResource resource
           
 
Constructor Summary
SetContentHandler(org.xmldb.api.modules.XMLResource resource)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data inside an element.
 void endDocument()
          Receive notification of the end of the document.
 void endElement(String uri, String localName, String qName)
          Receive notification of the end of an element.
 void endPrefixMapping(String prefix)
          Receive notification of the end of a Namespace mapping.
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(String target, String data)
          Receive notification of a processing instruction.
 void skippedEntity(String name)
          Receive notification of a skipped entity.
 void startDocument()
          Receive notification of the beginning of the document.
 void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes)
          Receive notification of the start of an element.
 void startPrefixMapping(String prefix, String uri)
          Receive notification of the start of a Namespace mapping.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, setDocumentLocator, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resource

protected org.xmldb.api.modules.XMLResource resource

newContent

protected StringBuffer newContent

namespaces

protected Map namespaces
Constructor Detail

SetContentHandler

public SetContentHandler(org.xmldb.api.modules.XMLResource resource)
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of the document.
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of the document.
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.endDocument()

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws org.xml.sax.SAXException
Receive notification of the start of a Namespace mapping.
Overrides:
startPrefixMapping in class org.xml.sax.helpers.DefaultHandler
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI mapped to the prefix.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws org.xml.sax.SAXException
Receive notification of the end of a Namespace mapping.
Overrides:
endPrefixMapping in class org.xml.sax.helpers.DefaultHandler
Parameters:
prefix - The Namespace prefix being declared.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Receive notification of the start of an element.
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
attributes - The specified or defaulted attributes.
uri - Description of Parameter
localName - Description of Parameter
qName - Description of Parameter
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - Description of Parameter
localName - Description of Parameter
qName - Description of Parameter
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data inside an element.
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Receive notification of ignorable whitespace in element content.
Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - The whitespace characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws org.xml.sax.SAXException
Receive notification of a processing instruction.
Overrides:
processingInstruction in class org.xml.sax.helpers.DefaultHandler
Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none is supplied.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

skippedEntity

public void skippedEntity(String name)
                   throws org.xml.sax.SAXException
Receive notification of a skipped entity.
Overrides:
skippedEntity in class org.xml.sax.helpers.DefaultHandler
Parameters:
name - The name of the skipped entity.
Throws:
org.xml.sax.SAXException - Description of Exception
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

Xindice API
version 1.1

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