|
|||||||||
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 desparate 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. |
Constructor Summary | |
---|---|
XMLUtils()
|
Method Summary | |
---|---|
static String |
escapeStringForXML(String s)
Returns a String in which all of the special characters of XML have been escaped. |
static String |
escapeTextAroundXMLTags(String s)
|
static List<Node> |
getNodesFromXPath(String xpath,
Node node)
|
static String |
getStringFromXPath(String xpath,
Node node)
|
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 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
Constructor Detail |
---|
public XMLUtils()
Method Detail |
---|
public static String stripTags(Reader r, List 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 escapeStringForXML(String s)
s
-
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 String getStringFromXPath(String xpath, Node node)
xpath
- node
-
public static List<Node> getNodesFromXPath(String xpath, Node node)
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 |