Class DalResultXMLFilter
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
uk.ac.starlink.vo.DalResultXMLFilter
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
SAX 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(VOElementFactory, InputSource)
utility method.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDalResultXMLFilter(XMLReader parent, uk.ac.starlink.votable.Namespacing namespacing) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) voidendElement(String namespaceURI, String localName, String qName) voidendPrefixMapping(String prefix) static uk.ac.starlink.table.StarTablegetDalResultTable(uk.ac.starlink.votable.VOElementFactory vofact, 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, InputSource inSrc) Utility method which uses an instance of this class to turn a SAX InputSource into a DOM.voidprocessingInstruction(String target, String data) voidskippedEntity(String name) voidstartElement(String namespaceURI, String localName, String qName, Attributes atts) voidstartPrefixMapping(String prefix, String uri) Methods inherited from class 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, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Constructor Details
-
DalResultXMLFilter
Constructor.- Parameters:
parent- parent SAX readernamespacing- VOTable namespacing policy to employ
-
-
Method Details
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classXMLFilterImpl- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classXMLFilterImpl- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classXMLFilterImpl- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classXMLFilterImpl- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classXMLFilterImpl- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classXMLFilterImpl- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classXMLFilterImpl- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntityin interfaceContentHandler- Overrides:
skippedEntityin classXMLFilterImpl- Throws:
SAXException
-
parseDalResult
public static uk.ac.starlink.votable.VOElement parseDalResult(uk.ac.starlink.votable.VOElementFactory vofact, InputSource inSrc) throws IOException Utility 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:
IOException
-
getDalResultTable
public static uk.ac.starlink.table.StarTable getDalResultTable(uk.ac.starlink.votable.VOElementFactory vofact, InputSource inSrc) throws IOException Utility 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:
IOException- in case of error, including an ERROR-valued QUERY_STATUS in the response, or no suitable table found
-