Here you can find the source of getElementText(Document owner, String elementName, String nsURI)
Parameter | Description |
---|---|
owner | Document object to search. |
elementName | local name to search for. |
nsURI | namespaceURI to used (may be null). |
null
if none is found.
public static String getElementText(Document owner, String elementName, String nsURI)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { /**/*w ww. j a v a 2s. com*/ * Returns the text value of the given element name in the CyberSource * namespace. * * @param owner Document object to search. * @param elementName local name to search for. * @param nsURI namespaceURI to used (may be null). * @return the text value of the given element name in the CyberSource * namespace or <code>null</code> if none is found. */ public static String getElementText(Document owner, String elementName, String nsURI) { Element elem = getElement(owner, elementName, nsURI); if (elem != null) { return (elem.getFirstChild().getNodeValue()); } return (null); } /** * Returns the Element object corresponding to the given element name. * * @param owner Document object to search. * @param elementName local name to search for. * @param nsURI namespaceURI to used (may be null). * @return the Element object corresponding to the given element name or * <code>null</code> if none is found. */ public static Element getElement(Document owner, String elementName, String nsURI) { NodeList nodes = nsURI != null ? owner.getElementsByTagNameNS(nsURI, elementName) : owner.getElementsByTagName(elementName); if (nodes != null && nodes.getLength() > 0) { return ((Element) nodes.item(0)); } return (null); } }