The XPath you specified is not quite right. The following code worked.
This posting is provided "AS IS" with no warranties, and confers no rights.
>Date: Fri, 18 Feb 2005 18:32:01 +0100
>From: Martin Honnen <mahotrash@yahoo.de>
>Reply-To: Martin.Honnen@gmx.de
>Organization: Liberty Development
>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2)
Gecko/20040804 Netscape/7.2 (ax)
>X-Accept-Language: en-us, en
>MIME-Version: 1.0
>Subject: Re: XPath query problem w-attributes
>References: <BE9312AB-C100-4A29-8029-8770DB2A8F7A@microsoft.com>
>In-Reply-To: <BE9312AB-C100-4A29-8029-8770DB2A8F7A@microsoft.com>
>Content-Type: text/plain; charset=us-ascii; format=flowed
>Content-Transfer-Encoding: 7bit
>Message-ID: <uI#fG$dFFHA.3664@TK2MSFTNGP15.phx.gbl>
>Newsgroups: microsoft.public.dotnet.xml
>NNTP-Posting-Host: i538783b2.versanet.de 83.135.131.178
>Lines: 1
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.xml:5756
>X-Tomcat-NG: microsoft.public.dotnet.xml
>
>
>
>Dave Lech wrote:
>
>> In a C# app I have an XPath query where I am trying to return a single
node
>> based on the value of 2 different attributes.
>> The xml looks something like this:
>>
>> <TESTS>
>> <TEST SAMPLE_NUMBER="1" TEST_NUMBER="1"/>
>> <TEST SAMPLE_NUMBER="1" TEST_NUMBER="2"/>
>> <TEST SAMPLE_NUMBER="2" TEST_NUMBER="1"/>
>> <TEST SAMPLE_NUMBER="2" TEST_NUMBER="2"/>
>> </TESTS>
>>
>>
>> From the TESTS node I am calling the SelectSingleNode() method like this:
>>
>> XmlNode testNode = testsNode.SelectSingleNode("TEST[@SAMPLE_NUMBER = 1
and
>> @TEST_NUMBER = 1]");
>>
>> I keep getting an "Invalid token" exception. What is wrong?
>
>Does the C# compile?
>If the exception occurs at runtime on which line does it occur, the
>SelectSingleNode or earlier?
>
>--
>
> Martin Honnen
>
http://JavaScript.FAQTs.com/ >