public class XMLBlacklistImporter
extends org.xml.sax.helpers.DefaultHandler
ListAccumulator
object.Modifier and Type | Field and Description |
---|---|
private ListAccumulator |
ba |
private java.lang.String |
currentListName |
private java.lang.StringBuilder |
lastText |
Constructor and Description |
---|
XMLBlacklistImporter() |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Writes characters to a String which might be used by endElement() later.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Adds a new item to the current list in the
ListAccumulator . |
ListAccumulator |
parse(org.xml.sax.InputSource input)
Takes the input data and turns it into a
ListAccumulator which can
be used for further processing. |
ListAccumulator |
parse(java.io.InputStream input)
Takes the input data and turns it into a
ListAccumulator which can
be used for further processing. |
ListAccumulator |
parse(java.io.Reader input)
Takes the input data and turns it into a
ListAccumulator which can
be used for further processing. |
ListAccumulator |
parse(java.lang.String input)
Takes the input data and turns it into a
ListAccumulator which can
be used for further processing. |
void |
startDocument()
At the start of the document a new
ListAccumulator is created. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
If the
ListAccumulator and the properties of the list will be set
if provided in the XML. |
private ListAccumulator ba
private java.lang.String currentListName
private java.lang.StringBuilder lastText
public ListAccumulator parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
ListAccumulator
which can
be used for further processing.input
- the XML datajava.io.IOException
- if input can't be readorg.xml.sax.SAXException
- if XML can't be parsedpublic ListAccumulator parse(java.io.Reader input) throws java.io.IOException, org.xml.sax.SAXException
ListAccumulator
which can
be used for further processing.input
- the XML datajava.io.IOException
- if input can't be readorg.xml.sax.SAXException
- if XML can't be parsedpublic ListAccumulator parse(java.lang.String input) throws java.io.IOException, org.xml.sax.SAXException
ListAccumulator
which can
be used for further processing.input
- the XML datajava.io.IOException
- if input can't be readorg.xml.sax.SAXException
- if XML can't be parsedpublic ListAccumulator parse(java.io.InputStream input) throws java.io.IOException, org.xml.sax.SAXException
ListAccumulator
which can
be used for further processing.input
- The XML data.java.io.IOException
- if input can't be readorg.xml.sax.SAXException
- if XML can't be parsedpublic void startDocument()
ListAccumulator
is created.startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
ListAccumulator
and the properties of the list will be set
if provided in the XML.startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified name (with prefix), or the
empty string if qualified names are not available.attributes
- The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
ListAccumulator
.endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified name (with prefix), or the
empty string if qualified names are not available.org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- The characters.start
- The start position in the character array.lengthThe
- number of characters to use from the character array.org.xml.sax.SAXException