|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.XMLUtils
public class XMLUtils
Provides some utilities for dealing with XML files, both by properly parsing them and by using the methods of a desperate Perl hacker.
Nested Class Summary | |
---|---|
static class |
XMLUtils.XMLTag
|
Field Summary | |
---|---|
static Set<String> |
breakingTags
Block-level HTML tags that are rendered with surrounding line breaks. |
Method Summary | |
---|---|
static String |
escapeTextAroundXMLTags(String s)
|
static String |
escapeXML(String in)
Returns a String in which all the XML special characters have been escaped. |
static boolean |
isBreaking(String tag)
|
static boolean |
isBreaking(XMLUtils.XMLTag tag)
|
static void |
main(String[] args)
Tests a few methods. |
static XMLUtils.XMLTag |
parseTag(String tagString)
|
static XMLUtils.XMLTag |
readAndParseTag(Reader r)
|
static Document |
readDocumentFromFile(String filename)
|
static Document |
readDocumentFromString(String s)
|
static String |
readTag(Reader r)
Reads all text of the XML tag and returns it as a String. |
static String |
readUntilTag(Reader r)
Reads all text up to next XML tag and returns it as a String. |
static String |
stripTags(Reader r,
List<Integer> mapBack,
boolean markLineBreaks)
|
static String |
unescapeStringForXML(String s)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Set<String> breakingTags
Method Detail |
---|
public static String stripTags(Reader r, List<Integer> mapBack, boolean markLineBreaks)
r
- the reader to read the XML/HTML frommapBack
- a List of Integers mapping the positions in the result buffer
to positions in the original Reader, will be cleared on receipt
public static boolean isBreaking(String tag)
public static boolean isBreaking(XMLUtils.XMLTag tag)
public static String readUntilTag(Reader r) throws IOException
IOException
public static XMLUtils.XMLTag readAndParseTag(Reader r) throws Exception
Exception
public static String unescapeStringForXML(String s)
public static String escapeXML(String in)
in
- The String to escape
public static String escapeTextAroundXMLTags(String s)
public static String readTag(Reader r) throws IOException
r
- The reader to read from
<TXT>
IOException
public static XMLUtils.XMLTag parseTag(String tagString) throws Exception
Exception
public static Document readDocumentFromFile(String filename) throws Exception
Exception
public static Document readDocumentFromString(String s) throws Exception
Exception
public static void main(String[] args) throws Exception
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |