class ParserXMLText
extends org.xml.sax.helpers.DefaultHandler
The markup "Text" defines an association to a "key" with some text. The parameter "key" specify the text key. The text
between opening and closing markup "Text" is the corresponding text in the specific
language.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
key
Current key to associate with
|
private static java.lang.String |
MARKUP_TEXT
Markup "Text" where describes the association key<->text
|
private static java.lang.String |
PARAMETER_KEY
Parameter "key" for specify the key
|
private java.util.Hashtable<java.lang.String,java.lang.String> |
texts
Hash map to fill with associations
|
private java.lang.StringBuilder |
value
Current text value
|
Constructor and Description |
---|
ParserXMLText(java.util.Hashtable<java.lang.String,java.lang.String> texts,
java.net.URL url,
java.lang.String reference)
Create a new instance of ParserXMLText
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Called each time a part of a text is read
Parent documentation: |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Called each time a end of markup arrive
Parent documentation: |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Called each time a markup start
Parent documentation: |
private static final java.lang.String MARKUP_TEXT
private static final java.lang.String PARAMETER_KEY
private java.lang.String key
private final java.util.Hashtable<java.lang.String,java.lang.String> texts
private java.lang.StringBuilder value
public ParserXMLText(java.util.Hashtable<java.lang.String,java.lang.String> texts, java.net.URL url, java.lang.String reference)
texts
- Hash map to fill with associationsurl
- Stream where find the XML to parsereference
- Reference to the XML file (XML file identifier)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
- Array of read charactersstart
- Starting offset where find the start of reading textlength
- Number of character readorg.xml.sax.SAXException
- Not throw hereDefaultHandler.characters(char[], int, int)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- URI sourcelocalName
- Local nameqName
- Q-nameorg.xml.sax.SAXException
- Not throw hereDefaultHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- URI sourcelocalName
- Local nameqName
- Q-nameattributes
- Parameters of the markuporg.xml.sax.SAXException
- If the markup is "Text" and the parameter "key" is not presentDefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String,
org.xml.sax.Attributes)