org.inria.ns.reflex.xml
Class XMLBuilder.SAXSplitter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.inria.ns.reflex.xml.sax.SAXFilter
          extended by org.inria.ns.reflex.xml.sax.SAXSafeDocument
              extended by org.inria.ns.reflex.xml.XMLBuilder.SAXSplitter
All Implemented Interfaces:
Localizable, StandaloneProducer, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, LexicalHandler, XMLFilter, XMLReader
Enclosing class:
XMLBuilder

public class XMLBuilder.SAXSplitter
extends SAXSafeDocument
implements StandaloneProducer

A SAXSplitter fires SAX events to 2 handlers : one is the applicative handler, the other perform a copy to a DOM structure for reusability.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.sax.StandaloneProducer
StandaloneProducer.Impl
 
Constructor Summary
XMLBuilder.SAXSplitter()
           
 
Method Summary
 void attributeDecl(String eName, String aName, String type, String valueDefault, String value)
          Fire a SAX event.
 void characters(char[] ch, int start, int length)
          Filter a character data event.
 void comment(char[] ch, int start, int length)
          Fire a SAX event.
 void elementDecl(String name, String model)
          Fire a SAX event.
 void endCDATA()
          Fire a SAX event.
 void endDocument()
          Filter an end document event.
 void endDTD()
          Forward an end DTD, except if it has been blocked.
 void endElement(String uri, String localName, String qName)
          Filter an end element event.
 void endEntity(String name)
          Fire a SAX event.
 void endPrefixMapping(String prefix)
          Filter an end Namespace prefix mapping event.
 void externalEntityDecl(String name, String publicId, String systemId)
          Fire a SAX event.
 void ignorableWhitespace(char[] ch, int start, int length)
          Filter an ignorable whitespace event.
 void internalEntityDecl(String name, String value)
          Fire a SAX event.
 void notationDecl(String name, String publicId, String systemId)
          Filter a notation declaration event.
 void parse()
          Fire SAX events from an embedded source.
 void parse(InputSource input)
          Parse a document.
 void processingInstruction(String target, String data)
          Filter a processing instruction event.
 void setDocumentLocator(Locator locator)
          Filter a new document locator event.
 void skippedEntity(String name)
          Filter a skipped entity event.
 void startCDATA()
          Fire a SAX event.
 void startDocument()
          Filter a start document event.
 void startDTD(String name, String publicId, String systemId)
          Forward a start DTD, except if it has been blocked.
 void startElement(String uri, String localName, String qName, Attributes atts)
          Filter a start element event.
 void startEntity(String name)
          Fire a SAX event.
 void startPrefixMapping(String prefix, String uri)
          Filter a start Namespace prefix mapping event.
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          Filter an unparsed entity declaration event.
 
Methods inherited from class org.inria.ns.reflex.xml.sax.SAXFilter
getDeclHandler, getLexicalHandler, getLocation, getProperty, isLocalizable, parse, setDeclHandler, setLexicalHandler, setLocation, setProperty
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.XMLReader
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty
 

Constructor Detail

XMLBuilder.SAXSplitter

public XMLBuilder.SAXSplitter()
Parameters:
parserConfiguration -
Method Detail

parse

public void parse(InputSource input)
           throws SAXException,
                  IOException
Parse a document.

Specified by:
parse in interface XMLReader
Overrides:
parse in class XMLFilterImpl
Parameters:
input - The input source for the document entity.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See Also:
XMLReader.parse(org.xml.sax.InputSource)

parse

public void parse()
           throws SAXException
Description copied from interface: StandaloneProducer
Fire SAX events from an embedded source.

Specified by:
parse in interface StandaloneProducer
Throws:
SAXException - For compatibility.
See Also:
StandaloneProducer.parse()

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
                  throws SAXException
Filter a notation declaration event.

Specified by:
notationDecl in interface DTDHandler
Overrides:
notationDecl in class XMLFilterImpl
Parameters:
name - The notation name.
publicId - The notation's public identifier, or null.
systemId - The notation's system identifier, or null.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
                        throws SAXException
Filter an unparsed entity declaration event.

Specified by:
unparsedEntityDecl in interface DTDHandler
Overrides:
unparsedEntityDecl in class XMLFilterImpl
Parameters:
name - The entity name.
publicId - The entity's public identifier, or null.
systemId - The entity's system identifier, or null.
notationName - The name of the associated notation.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(Locator locator)
Filter a new document locator event.

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class XMLFilterImpl
Parameters:
locator - The document locator.
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

startDocument

public void startDocument()
                   throws SAXException
Filter a start document event.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class SAXFilter
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws SAXException
Filter an end document event.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class SAXFilter
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endDocument()

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Filter a start Namespace prefix mapping event.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class XMLFilterImpl
Parameters:
prefix - The Namespace prefix.
uri - The Namespace URI.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Filter an end Namespace prefix mapping event.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class XMLFilterImpl
Parameters:
prefix - The Namespace prefix.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Filter a start element event.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class SAXSafeDocument
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
atts - The element's attributes.
Throws:
SAXException - The client may throw an exception during processing.
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 SAXException
Filter an end element event.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Filter a character data event.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class SAXSafeDocument
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Filter an ignorable whitespace event.

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class XMLFilterImpl
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Filter a processing instruction event.

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class XMLFilterImpl
Parameters:
target - The processing instruction target.
data - The text following the target.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Filter a skipped entity event.

Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in class XMLFilterImpl
Parameters:
name - The name of the skipped entity.
Throws:
SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.skippedEntity(java.lang.String)

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Description copied from class: SAXSafeDocument
Forward a start DTD, except if it has been blocked.

Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in class SAXSafeDocument
Parameters:
name - The name of the DTD.
publicId - Its public identifier.
systemId - Its system identifier.
Throws:
SAXException
See Also:
SAXFilter.startDTD(java.lang.String, java.lang.String, java.lang.String)

endDTD

public void endDTD()
            throws SAXException
Description copied from class: SAXSafeDocument
Forward an end DTD, except if it has been blocked.

Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in class SAXSafeDocument
Throws:
SAXException
See Also:
SAXFilter.endDTD()

startEntity

public void startEntity(String name)
                 throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
startEntity in interface LexicalHandler
Overrides:
startEntity in class SAXFilter
Throws:
SAXException
See Also:
LexicalHandler.startEntity(java.lang.String)

endEntity

public void endEntity(String name)
               throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
endEntity in interface LexicalHandler
Overrides:
endEntity in class SAXFilter
Throws:
SAXException
See Also:
LexicalHandler.endEntity(java.lang.String)

startCDATA

public void startCDATA()
                throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class SAXFilter
Throws:
SAXException
See Also:
LexicalHandler.startCDATA()

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class SAXFilter
Throws:
SAXException
See Also:
LexicalHandler.endCDATA()

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class SAXFilter
Throws:
SAXException
See Also:
LexicalHandler.comment(char[], int, int)

elementDecl

public void elementDecl(String name,
                        String model)
                 throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
elementDecl in interface DeclHandler
Overrides:
elementDecl in class SAXFilter
Throws:
SAXException
See Also:
DeclHandler.elementDecl(java.lang.String, java.lang.String)

attributeDecl

public void attributeDecl(String eName,
                          String aName,
                          String type,
                          String valueDefault,
                          String value)
                   throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
attributeDecl in interface DeclHandler
Overrides:
attributeDecl in class SAXFilter
Throws:
SAXException
See Also:
DeclHandler.attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

internalEntityDecl

public void internalEntityDecl(String name,
                               String value)
                        throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
internalEntityDecl in interface DeclHandler
Overrides:
internalEntityDecl in class SAXFilter
Throws:
SAXException
See Also:
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)

externalEntityDecl

public void externalEntityDecl(String name,
                               String publicId,
                               String systemId)
                        throws SAXException
Description copied from class: SAXFilter
Fire a SAX event.

Specified by:
externalEntityDecl in interface DeclHandler
Overrides:
externalEntityDecl in class SAXFilter
Throws:
SAXException
See Also:
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)