public static String textForFirstTag(Element element, String tag) {
		if (!element.hasChildNodes())
			return ""; // Should never happen if we are passed a valid Element
						// node

		NodeList tagList = element.getChildNodes();
		int tagCount = tagList.getLength();
		if (0 == tagCount) // No tags
			return "";

		for (int j = 0; j < tagCount; ++j) {
			Node tagNode = tagList.item(j);
			if (isMatchingNode(tagNode, tag)) {

				// Look at the children of this tag element. There should be
				// one or more Text nodes.

				NodeList list = tagNode.getChildNodes();
				int count = list.getLength();
				for (int i = 0; i < count; ++i) {
					Node node = list.item(i);
					if (node instanceof Text) {
						String value = trim((Text) node);
						if (!("".equals(value)))
							return value; // Return the trim()'d text of the
											// first child text node
					}
				} // for i...
			} // if match
		} // for j...
		return "";
	}