net.sf.stax
Interface StAXContentHandler

All Known Implementing Classes:
BooleanElementHandler, ByteElementHandler, CharElementHandler, DispatchForChild, DispatchOnElement, DispatchOnElement.ByLocalName, DispatchOnElement.ByNsURI, DispatchOnElement.ByQName, DoubleElementHandler, FloatElementHandler, IntElementHandler, LongElementHandler, StAXContentHandlerBase, StringElementHandler

public interface StAXContentHandler

Receive notification of the logical content of a sub-tree of a document and provide access to delegation and id mapping services.

  1. start/endDocument methods are replaced by start/endTree. This recognises the fact that a StAX content handler may only see a sub-tree of an XML document, rather than the whole document.
  2. the startElement method takes a StAXDelegationContext, allowing delegation of sub-trees to other content handlers.
  3. all other methods take a StAXContext, allowing for the mapping of XML ids to java objects.

Version:
$Revision: 1.3 $ $Date: 2006/01/02 20:37:34 $
Author:
Thomas Down, Matthew Pocock, Michael Heuer

Field Summary
static StAXContentHandler IGNORE
          No-op instance of StAXContentHandler.
 
Method Summary
 void characters(char[] ch, int start, int length, StAXContext ctx)
          Receive notification of character data.
 void endElement(String nsURI, String localName, String qName, Object result, StAXContext ctx)
          Receive notification of the end of an element.
 void endPrefixMapping(String prefix, StAXContext ctx)
          End the scope of a prefix-URI mapping.
 Object endTree(StAXContext ctx)
          Receive notification of the end of a sub-tree of a document.
 void ignorableWhitespace(char[] ch, int start, int length, StAXContext ctx)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(String target, String data, StAXContext ctx)
          Receive notification of a processing instruction.
 void setDocumentLocator(Locator locator, StAXContext ctx)
          Receive an object for locating the origin of SAX document events.
 void skippedEntity(String name, StAXContext ctx)
          Receive notification of a skipped entity.
 void startElement(String nsURI, String localName, String qName, Attributes attrs, StAXDelegationContext dctx)
          Receive notification of the beginning of an element.
 void startPrefixMapping(String prefix, String uri, StAXContext ctx)
          Begin the score of a prefix-URI Namespace mapping.
 void startTree(StAXContext ctx)
          Receive notification of the beginning of a sub-tree of a document.
 

Field Detail

IGNORE

static final StAXContentHandler IGNORE
No-op instance of StAXContentHandler.

Method Detail

startTree

void startTree(StAXContext ctx)
               throws SAXException
Receive notification of the beginning of a sub-tree of a document.

Parameters:
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

endTree

Object endTree(StAXContext ctx)
               throws SAXException
Receive notification of the end of a sub-tree of a document.

Parameters:
ctx - StAX context
Returns:
return value
Throws:
SAXException - any SAX exception, possibly wrapping another exception

characters

void characters(char[] ch,
                int start,
                int length,
                StAXContext ctx)
                throws SAXException
Receive notification of character data.

Parameters:
ch - characters from the XML document
start - start position in the array
length - number of characters to read from the array
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

ignorableWhitespace

void ignorableWhitespace(char[] ch,
                         int start,
                         int length,
                         StAXContext ctx)
                         throws SAXException
Receive notification of ignorable whitespace in element content.

Parameters:
ch - characters from the XML document
start - start position in the array
length - number of characters to read from the array
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

startPrefixMapping

void startPrefixMapping(String prefix,
                        String uri,
                        StAXContext ctx)
                        throws SAXException
Begin the score of a prefix-URI Namespace mapping.

Parameters:
prefix - namespace prefix being declared
uri - namespace URI the prefix is mapped to
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

endPrefixMapping

void endPrefixMapping(String prefix,
                      StAXContext ctx)
                      throws SAXException
End the scope of a prefix-URI mapping.

Parameters:
prefix - prefix that was being mapped
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

processingInstruction

void processingInstruction(String target,
                           String data,
                           StAXContext ctx)
                           throws SAXException
Receive notification of a processing instruction.

Parameters:
target - processing instruction target
data - processing instruction data
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

setDocumentLocator

void setDocumentLocator(Locator locator,
                        StAXContext ctx)
Receive an object for locating the origin of SAX document events.

Parameters:
locator - an object that can return the location of any SAX document event
ctx - StAX context

skippedEntity

void skippedEntity(String name,
                   StAXContext ctx)
                   throws SAXException
Receive notification of a skipped entity.

Parameters:
name - name of the skipped entity
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

startElement

void startElement(String nsURI,
                  String localName,
                  String qName,
                  Attributes attrs,
                  StAXDelegationContext dctx)
                  throws SAXException
Receive notification of the beginning of an element.

Parameters:
nsURI - namespace URI
localName - local name (without prefix)
qName - qualified XML name (with prefix)
attrs - attributes attached to the element
dctx - StAX delegation context
Throws:
SAXException - any SAX exception, possibly wrapping another exception

endElement

void endElement(String nsURI,
                String localName,
                String qName,
                Object result,
                StAXContext ctx)
                throws SAXException
Receive notification of the end of an element.

Parameters:
nsURI - namespace URI
localName - local name (without prefix)
qName - qualified XML name (with prefix)
result - result
ctx - StAX context
Throws:
SAXException - any SAX exception, possibly wrapping another exception


Copyright (c) 2001-2006 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).