org.biojava.bio.seq.io.filterxml
Class XMLFilterHandler

java.lang.Object
  extended by org.biojava.bio.seq.io.filterxml.XMLFilterHandler

public class XMLFilterHandler
extends java.lang.Object

Factory producing content handlers for parsing FilterXML elements.

An XMLFilterHandler object is a collection of individual StAX handlers for parsing FilterXML documents. It uses XMLAnnotationTypeHandler to parse byAnnotationType elements. To handle an individual XML filter, you should call the getStAXContentHandler method

Example:

       // Setup
       XMLFilterHandler filterHandler = new XMLFilterHandler();
       Reader xmlFile = new FileReader("featurefilter.xml");

       // Create an XML parser
       SAXParserFactory spf = SAXParserFactory.newInstance();
       spf.setNamespaceAware(true);
       XMLReader parser = spf.newSAXParser().getXMLReader();

       // Create a new handler for this document
       XMLFilterHandler.FilterHandler handler = filterHandler.getStAXContentHandler();
       parser.setContentHandler(new SAX2StAXAdaptor(handler));

       // Parse the file and retrieve the FeatureFilter
       parser.parse(new InputSource(xmlFile));
       FeatureFilter filter = handler.getFeatureFilter();
 

Since:
1.3
Author:
Thomas Down

Nested Class Summary
static interface XMLFilterHandler.FilterHandler
          StAXContentHandler for a particular type of FeatureFilter.
static interface XMLFilterHandler.FilterHandlerFactory
          Factory of StAXContentHandlers for a particular type of FeatureFilter.
 
Constructor Summary
XMLFilterHandler()
          Construct a new XMLFilterHandler which can parse the builtin types of FeatureFilter.
 
Method Summary
 XMLFilterHandler.FilterHandler getHandler(java.lang.String nsURI, java.lang.String localName)
          Retrieve a FilterHandler for the specified tag name.
 XMLFilterHandler.FilterHandler getStAXContentHandler()
          Return a StAXContentHandler which can deal with any FilterXML construct known to this class.
 void registerHandlerFactory(java.lang.String nsURI, java.lang.String localName, XMLFilterHandler.FilterHandlerFactory factory)
          Register a factory used to create handlers for the specified tag name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFilterHandler

public XMLFilterHandler()
Construct a new XMLFilterHandler which can parse the builtin types of FeatureFilter.

Method Detail

registerHandlerFactory

public void registerHandlerFactory(java.lang.String nsURI,
                                   java.lang.String localName,
                                   XMLFilterHandler.FilterHandlerFactory factory)
Register a factory used to create handlers for the specified tag name


getHandler

public XMLFilterHandler.FilterHandler getHandler(java.lang.String nsURI,
                                                 java.lang.String localName)
                                          throws org.xml.sax.SAXException
Retrieve a FilterHandler for the specified tag name.

Throws:
org.xml.sax.SAXException

getStAXContentHandler

public XMLFilterHandler.FilterHandler getStAXContentHandler()
Return a StAXContentHandler which can deal with any FilterXML construct known to this class.