public class ElementHandler extends Object
VotLintContentHandler
which
calls various methods on it in a controlled sequence as its life
cycle progresses to handle the current state of the parse.
Element-specific subclasses should generally override only the
startElement()
, endElement()
and characters(char[], int, int)
methods, which are invoked by the ContentHandler's similarly named
methods.
The checking done by an ElementHandler does not attempt to repeat or replace that done by validating against a DTD, it provides additional semantic checks based on what it knows about VOTables.
Constructor and Description |
---|
ElementHandler() |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Called when character content is found in the element.
|
void |
configure(String localName,
VotLintContext context)
Sets this handler up ready for use.
|
void |
endElement()
Called when the element has ended.
|
void |
error(VotLintCode code,
String msg)
Writes an error message through the context.
|
Ancestry |
getAncestry()
Returns an object containing the family relationships of this
handler.
|
String |
getAttribute(String name)
Returns the value of a named attribute.
|
VotLintContext |
getContext()
Returns this handler's context.
|
String |
getName()
Returns the localName for this element.
|
ElementRef |
getRef()
Returns a reference for this element.
|
void |
info(VotLintCode code,
String msg)
Writes an info message through the context.
|
void |
registerChildName(ElementRef child,
String name)
Called to indicate that a child of this element has a "name" attribute.
|
void |
setAncestry(Ancestry ancestry)
Sets the ancestry of this handler.
|
void |
setAttributes(Map<String,String> atts)
Sets this handler's attributes.
|
void |
startElement()
Called after the attributes have been set and checked.
|
String |
toString() |
void |
warning(VotLintCode code,
String msg)
Writes a warning message through the context.
|
public void configure(String localName, VotLintContext context)
localName
- local name of the element this handler knows aboutcontext
- lint contextpublic void setAncestry(Ancestry ancestry)
ancestry
- family valuespublic Ancestry getAncestry()
public ElementRef getRef()
public String getName()
public void setAttributes(Map<String,String> atts)
atts
- name -> value map representing this element's attributespublic String getAttribute(String name)
name
- attribute namepublic void startElement()
public void endElement()
public void characters(char[] ch, int start, int length)
public void registerChildName(ElementRef child, String name)
child
- child elementname
- value of child's name attributepublic VotLintContext getContext()
public void info(VotLintCode code, String msg)
code
- message identifiermsg
- message textpublic void warning(VotLintCode code, String msg)
code
- message identifiermsg
- message textpublic void error(VotLintCode code, String msg)
code
- message identifiermsg
- message textCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.