Package org.biojava.bio.dist
Class XMLDistributionReader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.biojava.bio.dist.XMLDistributionReader
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class XMLDistributionReader extends org.xml.sax.helpers.DefaultHandler
A SAX parser that reads an XML representation of a Distribution from a file and recreates it as a Distribution Object. Handles OrderNDistributions and Simple Distributions but ensure the OrderNDistributions being read in was made using conditioning and conditioned Alphabets.- Since:
- 1.3
- Author:
- Russell Smithies, Mark Schreiber, Matthew Pocock
-
-
Constructor Summary
Constructors Constructor Description XMLDistributionReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Distribution
parseXML(java.io.InputStream is)
Reads an XML representation of a Distribution from a file.void
startElement(java.lang.String nameSpaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes)
Required by SAXParser to be public.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Constructor Detail
-
XMLDistributionReader
public XMLDistributionReader()
-
-
Method Detail
-
parseXML
public Distribution parseXML(java.io.InputStream is) throws java.io.IOException, org.xml.sax.SAXException
Reads an XML representation of a Distribution from a file.- Parameters:
is
- input in XML format- Returns:
- dist the Distribution created.
- Throws:
java.io.IOException
- if an error occurs during reading.org.xml.sax.SAXException
- if the XML is not as expected.
-
startElement
public void startElement(java.lang.String nameSpaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
Required by SAXParser to be public.It is not reccomended that you use this method directly. Use ParseXML instead.
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
-