[jdom-interest] getChildText() by attribute
scarface at MAGMA.CA
Wed Jan 30 08:03:39 PST 2002
Is there a way to get the value associated with an element based on the
value of one of it's attributes?
If not, has anyone considered adding such a method to the Element class...
i.e. getChildTextByAttribute(String name, String attrName, String attrValue)
This method would return the text value for the child element that has an
attribute called 'attrName' and whose value is equal to 'attrValue'... this
would be helpful in situations like the one below:
<Feature name="Height">5' 10''</Feature>
We could then simply say:
personElement.getChildTextByAttribute("Feature", "name", "HairColor") to get
Just a thought.
More information about the jdom-interest