Package uk.ac.starlink.vo
Class DalResultXMLFilter
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- uk.ac.starlink.vo.DalResultXMLFilter
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler,org.xml.sax.XMLFilter,org.xml.sax.XMLReader
public class DalResultXMLFilter extends org.xml.sax.helpers.XMLFilterImplSAX filter which ignores any tables in a VOTable document, except those in a RESOURCE which has type="results". This is suitable for getting the basic table from the result of an SIA or SSA service. Under some circumstances the results can come with a large amount of non-result information (for instance massive numbers of small footprint tables from http://www.stecf.org/hst-vo/hst_ssa?), which can have a very serious impact on performance when trying to build a DOM. So if all you are interested in is the results table which the SIA/SSA protocol says has to be there, using this filter can save a lot of unnecessary processing.In many cases, you can just use the
getDalResultTable(uk.ac.starlink.votable.VOElementFactory, org.xml.sax.InputSource)utility method.
-
-
Constructor Summary
Constructors Constructor Description DalResultXMLFilter(org.xml.sax.XMLReader parent, uk.ac.starlink.votable.Namespacing namespacing)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)voidendPrefixMapping(java.lang.String prefix)static uk.ac.starlink.table.StarTablegetDalResultTable(uk.ac.starlink.votable.VOElementFactory vofact, org.xml.sax.InputSource inSrc)Utility method which can return the single results table from a DAL-type response.voidignorableWhitespace(char[] ch, int start, int length)static uk.ac.starlink.votable.VOElementparseDalResult(uk.ac.starlink.votable.VOElementFactory vofact, org.xml.sax.InputSource inSrc)Utility method which uses an instance of this class to turn a SAX InputSource into a DOM.voidprocessingInstruction(java.lang.String target, java.lang.String data)voidskippedEntity(java.lang.String name)voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)-
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, startDocument, unparsedEntityDecl, warning
-
-
-
-
Method Detail
-
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:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.xml.sax.helpers.XMLFilterImpl- 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:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException- Specified by:
startPrefixMappingin interfaceorg.xml.sax.ContentHandler- Overrides:
startPrefixMappingin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException- Specified by:
endPrefixMappingin interfaceorg.xml.sax.ContentHandler- Overrides:
endPrefixMappingin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException- Specified by:
ignorableWhitespacein interfaceorg.xml.sax.ContentHandler- Overrides:
ignorableWhitespacein classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException- Specified by:
processingInstructionin interfaceorg.xml.sax.ContentHandler- Overrides:
processingInstructionin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
skippedEntityin interfaceorg.xml.sax.ContentHandler- Overrides:
skippedEntityin classorg.xml.sax.helpers.XMLFilterImpl- Throws:
org.xml.sax.SAXException
-
parseDalResult
public static uk.ac.starlink.votable.VOElement parseDalResult(uk.ac.starlink.votable.VOElementFactory vofact, org.xml.sax.InputSource inSrc) throws java.io.IOExceptionUtility method which uses an instance of this class to turn a SAX InputSource into a DOM. The DOM will lack non-results tables.- Parameters:
vofact- factory which can generate VOTable DOMsinSrc- source of the SAX stream- Throws:
java.io.IOException
-
getDalResultTable
public static uk.ac.starlink.table.StarTable getDalResultTable(uk.ac.starlink.votable.VOElementFactory vofact, org.xml.sax.InputSource inSrc) throws java.io.IOExceptionUtility method which can return the single results table from a DAL-type response. This is the single table within the RESOURCE element marked with type="results", as described by the SIA and SSA standards. The QUERY_STATUS INFO element is checked; in case of ERROR, an exception is thrown.- Parameters:
vofact- factory which can generate VOTable DOMsinSrc- source of the SAX stream- Returns:
- result table, never null
- Throws:
java.io.IOException- in case of error, including an ERROR-valued QUERY_STATUS in the response, or no suitable table found
-
-