org.sadun.util.xml.configuration
Interface Configurator

All Superinterfaces:
org.xml.sax.ContentHandler
All Known Implementing Classes:
BaseConfigurator

public interface Configurator
extends org.xml.sax.ContentHandler

A Configurator is a SAX Content handler which receives SAX events pertaining only to a specific element in an XML document (and typically reacts incrementally configuring an associated object, hence the name).

For example, when parsing the following XML

 <?xml version="1.0"?>
  <elem1>
   <sub-elem1>
     ...
   </sub-elem1>
   <sub-elem2>
     ...
   </sub-elem2>
  </elem1>
 >
 
we might want to handle sub-elem1 and sub-elem2 with specific classes rather than into a single big SAX ContentHandler.

A Configurator is usually associated to an XML tag via some name transformation. For example, parsing the XML via a SAX parser by using a DispatcherHandler, a Configurator class can be associated to each element, which will receive only SAX events pertaining to that element.

Author:
Cristiano Sadun

Method Summary
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 java.lang.Object getConfiguredObject()
          Return the object resulting from the parsing of the specific XML element handled by this configurator, or null.
 java.lang.String getText()
          Return the text nodes resulting from the parsing of the specific XML element (if any) handled by this configurator, or null.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 

Method Detail

getConfiguredObject

public java.lang.Object getConfiguredObject()
                                     throws org.xml.sax.SAXException
Return the object resulting from the parsing of the specific XML element handled by this configurator, or null.

Throws:
org.xml.sax.SAXException

getText

public java.lang.String getText()
Return the text nodes resulting from the parsing of the specific XML element (if any) handled by this configurator, or null.


startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

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