|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.core.xml.dom.XmlDomUtils
Provides static methods for handling XML Document Object Mode (DOM) trees.
| Constructor Summary | |
XmlDomUtils()
|
|
| Method Summary | |
static Element |
getChildElementByTagName(Element parent,
String tagName)
Get a single child Element by tag name. |
static NodeList |
getChildElementNodes(Element parent)
Get Node children that are Elements. |
static List |
getChildElementsByTagName(Element parent,
String tagName)
Get all child Elements by tag name. |
static String |
getChildTextData(Element parent)
Get the data associated with a Text node within a parent Element. |
static boolean |
nameSpaceURIMatches(Node node1,
Node node2)
Return true if the namespace of the two Nodes matches. |
static Document |
parseDocument(Reader reader)
Parse the Document Object Model (DOM) from a reader. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XmlDomUtils()
| Method Detail |
public static Document parseDocument(Reader reader)
throws IOException,
SAXException,
ParserConfigurationException
If validation is desired, set the following System property: System.setProperty("validateXML", "true")
reader - the Reader from which the XML data is available.
IOException - if an error reading the XML data.
SAXException - if an error parsing the XML data.
ParserConfigurationException - if JAXP is unable to configure
a suitable Parser.
public static Element getChildElementByTagName(Element parent,
String tagName)
This method may be of use when a given parent is known to have one Element with the given tag name.
parent - the parent Element.tagName - the tag name for the child Element.
public static List getChildElementsByTagName(Element parent,
String tagName)
This method is of use when a given parent can have zero or more Elements with the given tag name.
parent - the parent Element.tagName - the tag name for the child Element.
public static NodeList getChildElementNodes(Element parent)
This method returns a NodeList of all first-generation child Nodes that are of type: Node.ELEMENT_NODE.
parent - the parent Element.
public static String getChildTextData(Element parent)
parent - the parent Element containing the Text node.
public static boolean nameSpaceURIMatches(Node node1,
Node node2)
node1 - the first Node.node2 - the second Node.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||