getDOM4JElementTextByTagName

In example file ProcessPersonsDOM4J.java, I found method “getDOM4JElementTextByTagName”.

Here is this method:

// Helpermethod to get the text of a given tagname from a DOM4J tree
private static String getDOM4JElementTextByTagName(Element element, String tagname) {
List list = element.elements();
Element elem = (Element)list.get(0);
return elem.node(0).getStringValue();
}

The problem is that it does not return appropriate tag using parameter “tagname” (in body of this method this variable is NEVER used!). I don’t really understand what is up. :frowning:

Data returned form tamino is similar to:


M

Hi,

It looks like a problem with the sample code. I changed it to:

private static String getDOM4JElementTextByTagName(Element element, String tagname) {
		List list = element.elements(tagname);
		Element elem = (Element)list.get(0);
		return elem.node(0).getStringValue();
	}

and that seemed to work.

If this is not what you want, the full javadoc for DOM4J is >here<

HTH

Yes, now it works.

So, I recommend to change this sample code immediately which the developers can download from:

http://developer.softwareag.com/tamino/TaminoAPI4J/download_request.htm

Thanks for help.

best regards,
Dariusz Baumann