Package org.biojava.bio.seq.io.filterxml
Class XMLFilterHandler
java.lang.Object
org.biojava.bio.seq.io.filterxml.XMLFilterHandler
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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceStAXContentHandler for a particular type of FeatureFilter.static interfaceFactory of StAXContentHandlers for a particular type of FeatureFilter. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new XMLFilterHandler which can parse the builtin types ofFeatureFilter. -
Method Summary
Modifier and TypeMethodDescriptiongetHandler(String nsURI, String localName) Retrieve aFilterHandlerfor the specified tag name.Return a StAXContentHandler which can deal with any FilterXML construct known to this class.voidregisterHandlerFactory(String nsURI, String localName, XMLFilterHandler.FilterHandlerFactory factory) Register a factory used to create handlers for the specified tag name
-
Constructor Details
-
XMLFilterHandler
public XMLFilterHandler()Construct a new XMLFilterHandler which can parse the builtin types ofFeatureFilter.
-
-
Method Details
-
registerHandlerFactory
public void registerHandlerFactory(String nsURI, String localName, XMLFilterHandler.FilterHandlerFactory factory) Register a factory used to create handlers for the specified tag name -
getHandler
public XMLFilterHandler.FilterHandler getHandler(String nsURI, String localName) throws SAXException Retrieve aFilterHandlerfor the specified tag name.- Throws:
SAXException
-
getStAXContentHandler
Return a StAXContentHandler which can deal with any FilterXML construct known to this class.
-