I have an XML file with two types of elements, both have IDs. I would like to get a NodeList with the ones that have a specific ID.
StringBuffer exp = new StringBuffer("//wert[@ID='");
exp.append(elementId);
exp.append("'] or //feld[@ID='");
exp.append(elementId);
exp.append("']");
XPathExpression expr = xpath.compile(exp.toString());
By doing this, however I get boolean as a return value. What would be the correct syntax, so that I could get a NodeList of the elements. Thanks!
Al
You want the union operator,
|. The XPath you build should look like