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?

[2352 byte] By [Taigoa] at [2007-11-27 4:42:39]
# 1
You misspelled "chapter" as "chatpter" in your Java code.
DrClapa at 2007-7-12 9:54:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
hi! it was my mistake while typing the code and inserting it in the forum. Buteven with the correction of the word "chapter", the expression Xpath is still not working. :(
Taigoa at 2007-7-12 9:54:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
The result of the query consists of two nodes. If you want to access both of them, use the NodeList type in place of the Node type:NodeList nodeList = (NodeList)xpath.evaluate(expression, doc, XPathConstants.NODESET);
prgguya at 2007-7-12 9:54:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
hi! great! it works!! thanks! (again) :)
Taigoa at 2007-7-12 9:54:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
> it was my mistake while typing the code and inserting> it in the forum. Don't waste your time (and our time) doing that. Haven't you ever heard of copy and paste? Paste works here too.
DrClapa at 2007-7-12 9:54:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...