public class SimpleXMLParser extends Object
Constructor and Description |
---|
SimpleXMLParser() |
Modifier and Type | Method and Description |
---|---|
static String |
getContentString(Element tag) |
static Document |
getDocument(File file) |
static Document |
getDocument(String filename) |
static Element |
getElement(Element parent,
String tagName) |
static String |
getTagContent(Element parent,
String tagName) |
static String |
getTagContent(Element parent,
String tagName,
String defaultResult) |
public static Document getDocument(String filename) throws XMLException
filename
- The file to parseDocument
XML tag -- the root of the document.XMLException
public static Document getDocument(File file) throws XMLException
file
- The file to parse.Document
XML tag -- the root of the document.XMLException
public static Element getElement(Element parent, String tagName) throws XMLException
parent
- The node containing the desired element tagtagName
- The name of the tagXMLException
public static String getContentString(Element tag) throws XMLException
tag
- (start) tag that encloses desired text.XMLException
- If the tag has no children.public static String getTagContent(Element parent, String tagName) throws XMLException
parent
- A node containing the tag enclosing desired text.tagName
- Name of tag containing desired text.XMLException
Copyright © 2017. All rights reserved.