org.inria.ns.reflex.xml.sax
Class SAXAdaptableParser

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.sax.SAXSafeParser
                  extended by org.inria.ns.reflex.xml.sax.SAXAdaptableParser
All Implemented Interfaces:
Localizable, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, LexicalHandler, XMLFilter, XMLReader

public class SAXAdaptableParser
extends SAXSafeParser

A SAXAdaptableParser parses an XML source that may be an entire XML document (with or without DTD stuff) as well as an XML fragment (with several root elements and/or eventually text around the root element(s) ).

Author:
Philippe Poulard
See Also:
DOMAdaptableParser

Constructor Summary
SAXAdaptableParser(ParserConfiguration parserConfiguration)
          Create a SAX parser that can parse entire XML documents as well as well-formed XML fragments.
 
Method Summary
 void alternateParse(InputSource input)
          Parse a document.
 void parse(InputSource input)
          Parse a document like a fragment, and if it fails, use the alternateParse(InputSource) method.
 
Methods inherited from class org.inria.ns.reflex.xml.sax.SAXSafeParser
startElement
 
Methods inherited from class org.inria.ns.reflex.xml.sax.SAXSafeDocument
characters, endDTD, startDTD
 
Methods inherited from class org.inria.ns.reflex.xml.sax.SAXFilter
attributeDecl, comment, elementDecl, endCDATA, endDocument, endEntity, externalEntityDecl, getDeclHandler, getLexicalHandler, getLocation, getProperty, internalEntityDecl, isLocalizable, parse, setDeclHandler, setLexicalHandler, setLocation, setProperty, startCDATA, startDocument, startEntity
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 

Constructor Detail

SAXAdaptableParser

public SAXAdaptableParser(ParserConfiguration parserConfiguration)
Create a SAX parser that can parse entire XML documents as well as well-formed XML fragments.

Parameters:
configuration - The non-null configuration expected for the parser, if one is needed.
Method Detail

parse

public void parse(InputSource input)
           throws SAXException,
                  IOException
Parse a document like a fragment, and if it fails, use the alternateParse(InputSource) method.

Specified by:
parse in interface XMLReader
Overrides:
parse in class SAXSafeParser
Parameters:
input - The document to parse.
Throws:
SAXException
IOException
See Also:
XMLFilterImpl.parse(org.xml.sax.InputSource)

alternateParse

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

Specified by:
alternateParse in class SAXSafeParser
Parameters:
input - The input source to parse.
Throws:
SAXException
IOException
See Also:
SAXSafeParser.alternateParse(org.xml.sax.InputSource)