001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.bio.seq.io.agave;
022import org.xml.sax.Attributes;
023import org.xml.sax.Locator;
024import org.xml.sax.SAXException;
025
026/**
027 * Interface for StAX content handlers.  This interface is
028 * very similar in spirit and design to the SAX content handler.
029 * Differences are:
030 *
031 * <ol>
032 * <li>start/endDocument methods are replaced by start/endTree.  This
033 *     recognises the fact that a StAX content handler may only see
034 *     a sub-tree of an XML document, rather than the whole document.</li>
035 * <li>the startElement method takes a <code>DelegationManager</code>,
036 *     allowing delegation of sub-trees to other content handlers.</li>
037 * </ol>
038 *
039 * @author copied from Thomas Down
040 */
041public interface StAXContentHandler {
042    public void startTree()
043        throws SAXException;
044
045    public void endTree()
046        throws SAXException;
047
048    public void characters(char[] ch,
049                           int start,
050                           int length)
051        throws SAXException;
052
053    public void ignorableWhitespace(char[] ch,
054                                    int start,
055                                    int length)
056        throws SAXException;
057
058    public void startPrefixMapping(String prefix, String uri)
059        throws SAXException;
060
061    public void endPrefixMapping(String prefix)
062        throws SAXException;
063
064    public void processingInstruction(String target, String data)
065        throws SAXException;
066
067    public void setDocumentLocator(Locator locator);
068
069    public void skippedEntity(String name)
070        throws SAXException;
071
072    public void startElement(String nsURI,
073                             String localName,
074                             String qName,
075                             Attributes attrs,
076                             DelegationManager dm)
077        throws SAXException;
078
079    public void endElement(String nsURI,
080                           String localName,
081                           String qName,
082                           StAXContentHandler delegate)
083        throws SAXException;
084}