Package cds.savot.stax
Class SavotStaxParser
java.lang.Object
cds.savot.stax.SavotStaxParser
- All Implemented Interfaces:
Markups
It has been tested with Java 1.6 Stax implementation but it is possible to use other Stax implementations
Designed to use with JSR-173 compliant (Streaming API for XML)
remark L. Bourgès : equalsIgnoreCase() vs() equals as XML is case sensitive and VOTable specification says that clearly
- Author:
- Andre Schaaff
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
default stack capacity = 4 slotsstatic final int
FULL parsing mode: deprecated and replaced by FULLREADstatic final int
FULLREAD parsing mode: all in memorystatic final int
RESOURCEREAD parsing mode: resource per resource readingstatic final int
ROWREAD parsing mode: row per row readingstatic final int
SEQUENTIAL parsing mode: deprecated and replaced by RESOURCEREADFields inherited from interface cds.savot.common.Markups
ACTION, ACTUATE, ARRAYSIZE, BINARY, CONTENTROLE, CONTENTTYPE, COOSYS, DATA, DATATYPE, DEFINITIONS, DESCRIPTION, ENCODING, EPOCH, EQUINOX, EXPIRES, EXTNUM, FIELD, FIELDREF, FITS, GREF, GROUP, HREF, ID, INCLUSIVE, INFO, INVALID, LINK, MAX, MIN, NAME, NROWS, NULL, OPTION, PARAM, PARAMREF, PRECISION, REF, RESOURCE, RIGHTS, SAVOTPARSER, STREAM, SYSTEM, SYSTEM_ATTRIBUTE, TABLE, TABLEDATA, TD, TITLE, TR, TYPE, UCD, UNIT, UTYPE, VALUE, VALUES, VERSION, VOTABLE, WIDTH, XML, XMLNS, XMLNSXSI, XSI, XSI_NOSCHEMA, XSI_SCHEMA, XSINOSCHEMA, XSISCHEMA, XTYPE
-
Constructor Summary
ConstructorsConstructorDescriptionSavotStaxParser
(InputStream instream, int mode) ConstructorSavotStaxParser
(InputStream instream, int mode, boolean debug) ConstructorSavotStaxParser
(InputStream instream, int mode, boolean debug, SavotStatistics stats) ConstructorSavotStaxParser
(Reader reader, int mode) ConstructorSavotStaxParser
(Reader reader, int mode, boolean debug) ConstructorSavotStaxParser
(Reader reader, int mode, boolean debug, SavotStatistics stats) ConstructorSavotStaxParser
(String file, int mode) ConstructorSavotStaxParser
(String file, int mode, boolean debug) ConstructorSavotStaxParser
(String file, int mode, boolean debug, SavotStatistics stats) ConstructorSavotStaxParser
(URL url, int mode) ConstructorSavotStaxParser
(URL url, int mode, boolean debug) ConstructorSavotStaxParser
(URL url, int mode, boolean debug, SavotStatistics stats) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the input stream if still opened and free the internal parservoid
enableDebug
(boolean debug) Enable debug modeGet current VOTable (all resources)getCoosysFromRef
(String ref) Search a COOSYS corresponding to an ID refint
Get the number of DATA elements in the document (for statistics)getFieldFromRef
(String ref) Search a FIELD corresponding to an ID refgetFieldRefFromRef
(String ref) Search a FIELDref corresponding to an ID refgetGroupFromRef
(String ref) Search a GROUP corresponding to an ID refGet a reference on the Hashtable containing the link between ID and refgetInfoFromRef
(String ref) Search a RESOURCE corresponding to an ID refgetLinkFromRef
(String ref) Search a LINK corresponding to an ID refGet the next Resource (warning : RESOURCEREAD mode only)Get the next TR (warning : ROWREAD mode only)getParamFromRef
(String ref) Search a PARAM corresponding to an ID refgetParamRefFromRef
(String ref) Search a PARAMref corresponding to an ID refint
Get the number of RESOURCE elements in the document (for statistics)getResourceFromRef
(String ref) Search a RESOURCE corresponding to an ID refReturns the statisticsint
Get the number of TABLE elements in the document (for statistics)getTableFromRef
(String ref) Search a TABLE corresponding to an ID refint
Get the number of TR elements in the document (for statistics)getValuesFromRef
(String ref) Search a VALUES corresponding to an ID refGet Parser VersionGet a reference to V0TABLE objectstatic void
Mainvoid
parse
(int parsingType) Parsing enginevoid
reset()
Reset of the engine before another parsing LBO: useless methods ?void
For test only
-
Field Details
-
FULL
public static final int FULLFULL parsing mode: deprecated and replaced by FULLREAD- See Also:
-
FULLREAD
public static final int FULLREADFULLREAD parsing mode: all in memory- See Also:
-
SEQUENTIAL
public static final int SEQUENTIALSEQUENTIAL parsing mode: deprecated and replaced by RESOURCEREAD- See Also:
-
RESOURCEREAD
public static final int RESOURCEREADRESOURCEREAD parsing mode: resource per resource reading- See Also:
-
ROWREAD
public static final int ROWREADROWREAD parsing mode: row per row reading- See Also:
-
DEFAULT_STACK_CAPACITY
public static final int DEFAULT_STACK_CAPACITYdefault stack capacity = 4 slots- See Also:
-
-
Constructor Details
-
SavotStaxParser
Constructor- Parameters:
file
- a file to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
IOException
XMLStreamException
-
SavotStaxParser
Constructor- Parameters:
file
- a file to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(String file, int mode, boolean debug, SavotStatistics stats) throws IOException, XMLStreamException Constructor- Parameters:
file
- a file to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-stats
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
Constructor- Parameters:
url
- url to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
IOException
XMLStreamException
-
SavotStaxParser
Constructor- Parameters:
url
- url to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(URL url, int mode, boolean debug, SavotStatistics stats) throws IOException, XMLStreamException Constructor- Parameters:
url
- url to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-stats
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
Constructor- Parameters:
instream
- stream to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(InputStream instream, int mode, boolean debug) throws IOException, XMLStreamException Constructor- Parameters:
instream
- stream to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(InputStream instream, int mode, boolean debug, SavotStatistics stats) throws IOException, XMLStreamException Constructor- Parameters:
instream
- stream to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-stats
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
Constructor- Parameters:
reader
- reader to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(Reader reader, int mode, boolean debug) throws IOException, XMLStreamException Constructor- Parameters:
reader
- reader to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-- Throws:
IOException
XMLStreamException
-
SavotStaxParser
public SavotStaxParser(Reader reader, int mode, boolean debug, SavotStatistics stats) throws IOException, XMLStreamException Constructor- Parameters:
reader
- reader to parsemode
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)debug
-stats
-- Throws:
IOException
XMLStreamException
-
-
Method Details
-
close
public void close()Close the input stream if still opened and free the internal parser -
reset
public void reset()Reset of the engine before another parsing LBO: useless methods ? -
parse
Parsing engine- Parameters:
parsingType
- FULLREAD (all in memory), RESOURCEREAD (per RESOURCE) or ROWREAD (per ROW, for small memory size applications)- Throws:
IOException
XMLStreamException
-
getNextResource
Get the next Resource (warning : RESOURCEREAD mode only)- Returns:
- a SavotResource (always NULL if other mode)
-
getNextTR
Get the next TR (warning : ROWREAD mode only)- Returns:
- a SavotTR (always NULL if other mode)
-
getVOTable
Get a reference to V0TABLE object- Returns:
- SavotVOTable
-
getResourceCount
public int getResourceCount()Get the number of RESOURCE elements in the document (for statistics)- Returns:
- a long value
-
getTableCount
public int getTableCount()Get the number of TABLE elements in the document (for statistics)- Returns:
- a long value
-
getTRCount
public int getTRCount()Get the number of TR elements in the document (for statistics)- Returns:
- a long value
-
getDataCount
public int getDataCount()Get the number of DATA elements in the document (for statistics)- Returns:
- a long value
-
getIdRefLinks
Get a reference on the Hashtable containing the link between ID and ref- Returns:
- a refernce to the Hashtable
-
getResourceFromRef
Search a RESOURCE corresponding to an ID ref- Parameters:
ref
-- Returns:
- a reference to a SavotResource object
-
getFieldFromRef
Search a FIELD corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotField
-
getFieldRefFromRef
Search a FIELDref corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotFieldRef
-
getParamFromRef
Search a PARAM corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotParam
-
getParamRefFromRef
Search a PARAMref corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotParamRef
-
getTableFromRef
Search a TABLE corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotTable
-
getGroupFromRef
Search a GROUP corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotGROUP
-
getInfoFromRef
Search a RESOURCE corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotInfo
-
getValuesFromRef
Search a VALUES corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotValues
-
getLinkFromRef
Search a LINK corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotLink
-
getCoosysFromRef
Search a COOSYS corresponding to an ID ref- Parameters:
ref
-- Returns:
- SavotCoosys
-
getAllResources
Get current VOTable (all resources)- Returns:
- SavotVOTable
-
enableDebug
public void enableDebug(boolean debug) Enable debug mode- Parameters:
debug
- boolean
-
getStatistics
Returns the statistics- Returns:
- statistics
-
getVersion
Get Parser Version- Returns:
- String
-
sequentialTester
public void sequentialTester()For test only -
main
Main- Parameters:
argv
-- Throws:
Exception
-