[jdom-interest] XPath and JDOM
Malachi de AElfweald
malachi at tremerechantry.com
Tue Nov 19 19:50:14 PST 2002
Perhaps something like this?
public static Element getSpecificChild(Element parentNode, String elemName,
String attrName, String attrVal)
List children = parentNode.getChildren(elemName);
if( (children == null) || (children.size() == 0) )
Iterator iter = children.iterator();
Element elem = (Element)iter.next();
String value = elem.getAttributeValue(attrName);
if( (value != null) && value.equals(attrValue) )
then, just call something like:
Element correctChild = getSpecificChild(someNode, "entry", "id", "5");
On Mon, 18 Nov 2002 16:12:49 +0200, Stefanos Kaklamanis <stefka at gnt.gr> wrote:
> I want to get a specific element ( where attribute id =5 ) from an JDOM
> document and edit/remove it from the document.
> Any suggestion about solutions and tools?
> PS. I already have a look at Jaxen and SAXPath, but I could take what i
More information about the jdom-interest