|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tudarmstadt.ukp.jwktl.parser.ru.wikokit.base.wikipedia.text.XMLTagsParser
public class XMLTagsParser
Parser of XML (HTML) tags, e.g. " <br />, etc.
Constructor Summary | |
---|---|
XMLTagsParser()
|
Method Summary | |
---|---|
static String |
escapeCharFromXML(String text)
Escapes characters for text appearing as XML data by HTML tags. |
protected static String |
isAmpersandTag(String text,
int pos)
If the 'text' (from the position 'pos') is one of tags: < > & " ' , – or — then this tag is returned, else empty string will be returned. |
protected static String |
isBRNewlineTag(String text,
int pos)
If the 'text' (from the position 'pos') is one of tags: <br />,<br/>,<br> then this tag is returned, else empty string will be returned. |
static String |
replaceCharFromXML(String text,
char replacement)
Removes the following characters from the text: <, >, &, ", also their expansions (<, >, &, ", ', , –, —) by the 'replacement' character. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLTagsParser()
Method Detail |
---|
protected static String isAmpersandTag(String text, int pos)
pos
- position in 'text' from which the tag will be extractedprotected static String isBRNewlineTag(String text, int pos)
pos
- position in 'text' from which the tag will be extractedpublic static String replaceCharFromXML(String text, char replacement)
public static String escapeCharFromXML(String text)
The following characters are replaced with corresponding character entities :
Character | Encoding |
---|---|
< | < |
> | > |
& | & |
" | " |
' | ' |
Note that JSTL's <c:out>
escapes the exact same set of
characters as this method. That is, <c:out>
is good for escaping to produce valid XML, but not for producing safe HTML.
see: http://www.javapractices.com/topic/TopicAction.do?Id=96
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |