|
JCas v0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cas.xml.XmlUtils
Helper class for parsing XML files.
Constructor Summary | |
XmlUtils()
|
Method Summary | |
static Node |
getChild(Node root,
String name)
Returns the first node with the specified tag name. |
static Node |
getChild(Node root,
String name,
int n)
Returns the n-th node with the specified tag name. |
static Node |
getChild(Node root,
String name,
String subname,
String subvalue)
Returns the first node with the specified tag name that contains a subnode of the specified subname with a specific value n ranges from 1... |
static int |
getChildCount(Node root,
String name)
Returns the number of nodes with the specified name. |
static String |
getNodeContent(Node root,
String name)
Returns the text that is contained in a tag <name> under the root node. |
static Element |
parseDOM(File xmlFile)
Parses the file and returns the root element for parsing. |
static Element |
parseDOM(String xmlFile)
Parses the file and returns the root element for parsing. |
static void |
parseSax(File file,
DefaultHandler handler)
Parses an XML file with default SAX parser. |
static void |
parseSax(InputStream in,
DefaultHandler handler)
Parses an InputStream with default SAX parser. |
static void |
parseSax(InputStream in,
DefaultHandler handler,
boolean logLocation)
Parses an InputStream with default SAX parser. |
static void |
parseSax(String file,
DefaultHandler handler)
Parses an XML file with default SAX parser. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XmlUtils()
Method Detail |
public static Element parseDOM(File xmlFile)
public static void parseSax(InputStream in, DefaultHandler handler) throws IOException, SAXException, ParserConfigurationException
in
- the stream to parsehandler
- the SAX Content handler.
IOException
SAXException
ParserConfigurationException
public static void parseSax(InputStream in, DefaultHandler handler, boolean logLocation) throws IOException, SAXException, ParserConfigurationException
in
- the stream to parsehandler
- the SAX Content handler.logLocation
- true if the location should be logged in case of an error.
IOException
SAXException
ParserConfigurationException
public static void parseSax(File file, DefaultHandler handler) throws IOException, SAXException, ParserConfigurationException
file
- the XML file to parsehandler
- the SAX Content handler.
IOException
SAXException
ParserConfigurationException
public static String getNodeContent(Node root, String name)
public static int getChildCount(Node root, String name)
public static Node getChild(Node root, String name)
public static Node getChild(Node root, String name, String subname, String subvalue)
public static Node getChild(Node root, String name, int n)
public static Element parseDOM(String xmlFile)
public static void parseSax(String file, DefaultHandler handler) throws IOException, SAXException, ParserConfigurationException
file
- the XML file to parsehandler
- the SAX Content handler.
IOException
SAXException
ParserConfigurationException
|
JCas v0.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |