Package uk.ac.starlink.ttools.votlint
Class VotLintContext
java.lang.Object
uk.ac.starlink.ttools.votlint.VotLintContext
Context for a VOTLint process. This is the object which knows most of
the available global information about the parse. It also provides
facilities for reporting log information about the parse to the user.
- Author:
- Mark Taylor (Starlink)
-
Constructor Summary
ConstructorsConstructorDescriptionVotLintContext
(uk.ac.starlink.votable.VOTableVersion version, boolean validate, SaxMessager messager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
error
(VotLintCode code, String msg) Write an error message to the user.Returns the SAX document locator for this parse.Returns prefix->namespaceURI map for the xmlns namespaces currently in scope.uk.ac.starlink.votable.VOTableVersion
Returns the version of VOTable this context is parsing.void
info
(VotLintCode code, String msg) Write an informative message to the user.boolean
Indicates whether ucd attribute values will be checked.boolean
Indicates whether unit attribute values will be checked.boolean
Indicates whether this lint is validating.void
registerID
(String id, ElementHandler handler) Register the fact that an XML ID-type attribute has been seen on an element.void
registerRef
(String id, ElementRef from, RefChecker checker) Register the fact that an XML IDREF-type attribute has been seen on an element.void
Goes through all the unresolved IDREF->ID arcs and reports them.void
Goes through all declared IDs that were never referenced.void
setCheckUcd
(boolean checkUcd) Sets whether ucd attribute values will be checked.void
setCheckUnit
(boolean checkUnit) Sets whether unit attribute values will be checked.void
setLocator
(Locator locator) Sets the SAX document locator for this parse.void
warning
(VotLintCode code, String msg) Write a warning message to the user.
-
Constructor Details
-
VotLintContext
public VotLintContext(uk.ac.starlink.votable.VOTableVersion version, boolean validate, SaxMessager messager) Constructor.- Parameters:
version
- version of VOTable for which the parse will be donevalidate
- if true, validation will be performed against the appropriate DTD/schemamessager
- destination for validation messages
-
-
Method Details
-
getVersion
public uk.ac.starlink.votable.VOTableVersion getVersion()Returns the version of VOTable this context is parsing.- Returns:
- version object
-
isValidating
public boolean isValidating()Indicates whether this lint is validating.- Returns:
- true for validating lint
-
isCheckUcd
public boolean isCheckUcd()Indicates whether ucd attribute values will be checked. Checking is currently against the UCD1+ standard.- Returns:
- whether to check UCD syntax
-
setCheckUcd
public void setCheckUcd(boolean checkUcd) Sets whether ucd attribute values will be checked. Checking is currently against the UCD1+ standard.- Parameters:
checkUcd
- whether to check UCD syntax
-
isCheckUnit
public boolean isCheckUnit()Indicates whether unit attribute values will be checked. Checking is against the VOUnits standard.- Returns:
- whether to check unit syntax
-
setCheckUnit
public void setCheckUnit(boolean checkUnit) Sets whether unit attribute values will be checked. Checking is against the VOUnits standard.- Parameters:
checkUnit
- whether to check unit syntax
-
setLocator
Sets the SAX document locator for this parse.- Parameters:
locator
- locator
-
getLocator
Returns the SAX document locator for this parse.- Returns:
- locator
-
getNamespaceMap
Returns prefix->namespaceURI map for the xmlns namespaces currently in scope. -
registerID
Register the fact that an XML ID-type attribute has been seen on an element.- Parameters:
id
- ID valuehandler
- element labelledid
-
registerRef
Register the fact that an XML IDREF-type attribute has been seen on an element.- Parameters:
id
- ID valuefrom
- the element on which the ref has been seenchecker
- the checker which knows how to check links of this type
-
reportUncheckedRefs
public void reportUncheckedRefs()Goes through all the unresolved IDREF->ID arcs and reports them. This is done at the end of the parse. -
reportUnusedIds
public void reportUnusedIds()Goes through all declared IDs that were never referenced. Such unreferenced IDs are not an error, but in some cases this is susplicious, so warnings may be reported. This is done at the end of the parse. -
info
Write an informative message to the user.- Parameters:
code
- message identifiermsg
- message text
-
warning
Write a warning message to the user.- Parameters:
code
- message identifiermsg
- message text
-
error
Write an error message to the user.- Parameters:
code
- message identifiermsg
- message text
-