xpath expression don't work
i need to select two "sect" by idtry{
// parse the XML as a W3C Document
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new File("book1.xml"));
XPath xpath = XPathFactory.newInstance().newXPath();
String expression ="//chapter/sect[@id='secC'] | //chatpter/sect[@id='secA']";//select two attributes (this don't works, why?)
// obtain the element as a node.
Node node = (Node)xpath.evaluate(expression, doc, XPathConstants.NODE);
but using the same Xpath expression on xsl the expressions works
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:copy-of select="//chapter/sect[@id='secB']| //chapter/sect[@id='secC']"/>
</xsl:template>
</xsl:stylesheet>
may xml file <chapter id="chapter1">
<sect id="secA">
<para id="a1">texto a1.</para>
<para id="a2">texto a2.</para>
<para id="a3">texto a3.</para>
</sect>
<sect id="secB">
<para id="b1">texto b1.</para>
<para id="b2">texto b2.</para>
<para id="b3">texto b3.</para>
</sect>
<sect id="secC">
<para id="c1">texto b1.</para>
<para id="c2">texto b2.</para>
<para id="c3">texto b3.</para>
</sect>
</chapter>
can anyone help?

