|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hudson.plugins.violations.parse.AbstractParser
public abstract class AbstractParser
Base class for parsing xml files. Contains a number of utility protected methods to aid in use of XmlPullParser.
Constructor Summary | |
---|---|
AbstractParser()
|
Method Summary | |
---|---|
protected void |
checkEvent(int event,
java.lang.String message)
check the current event type. |
protected java.lang.String |
checkGetAttribute(java.lang.String name)
Get an attribute value and ensure that the attribute is present. |
protected int |
checkGetInt(java.lang.String name)
Get an attribute value as an int and ensure that the attribute is present. |
protected long |
checkGetLong(java.lang.String name)
Get an attribute value as a long and ensure that the attribute is present. |
protected void |
checkNextEvent(int event,
java.lang.String message)
get the next event and check the type. |
protected java.lang.String |
checkNotBlank(java.lang.String name)
Get an attribute value and ensure that the attribute is present and is not blank. |
protected void |
endElement()
skip to the end of the element. |
protected abstract void |
execute()
Abstract method to run the parsing. |
protected void |
expectNextTag(java.lang.String tag)
Find the next START_TAG event and throw an exception if the tagname is not "tag"; |
protected void |
expectStartTag(java.lang.String tag)
Find the next START_TAG event and throw an exception if the tagname is not "tag"; |
protected int |
getInt(java.lang.String name)
Get an attribute value as an int. |
protected java.lang.String |
getNextText(java.lang.String message)
Get the next event and check it is a text event. |
protected org.xmlpull.v1.XmlPullParser |
getParser()
Get the parser. |
protected java.lang.String |
getSibTag()
get the next sibling element. |
protected java.lang.String |
getString(java.lang.String name)
Get an attribute value as a string. |
void |
setParser(org.xmlpull.v1.XmlPullParser parser)
Set the parser. |
protected void |
skipTag()
Assume at a start tag, skip it and the rest of the element. |
protected boolean |
skipToTag(java.lang.String tagName)
Skip to a specific tag within a element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractParser()
Method Detail |
---|
protected org.xmlpull.v1.XmlPullParser getParser()
public void setParser(org.xmlpull.v1.XmlPullParser parser)
parser
- the value to use.protected abstract void execute() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected java.lang.String getString(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected int getInt(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected int checkGetInt(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax
or the attribute is not present.protected long checkGetLong(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax,
of the attribute is not present.protected java.lang.String checkGetAttribute(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax,
or the attribute is not present.protected java.lang.String checkNotBlank(java.lang.String name) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
name
- the name of the attribute.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.
or the attribute is not present or is blank.protected boolean skipToTag(java.lang.String tagName) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
tagName
- the tag to look for.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected java.lang.String getSibTag() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void skipTag() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void expectStartTag(java.lang.String tag) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
tag
- the tag to expect.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void expectNextTag(java.lang.String tag) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
tag
- the tag to expect.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void checkEvent(int event, java.lang.String message) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
event
- the event type expected.message
- a message to use in the RT exception if the
event is not found.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void checkNextEvent(int event, java.lang.String message) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
event
- the event type expected.message
- a message to use in the RT exception if the
event is not found.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected java.lang.String getNextText(java.lang.String message) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
message
- a message to use in the RT exception if the
TEXT event is not found.
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.protected void endElement() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
java.io.IOException
- if there is a problem writing or reading.
org.xmlpull.v1.XmlPullParserException
- if there is a problem in the syntax.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |