mtugnoli wrote:
This is my XML file
<?xml version="1.0" encoding="utf-8"?>
<index>
<folder Name="Test1">
<folder Name="Test2">
<files>
<file Name="After You've Gone.mp3"/>
<file Name="Prova.mp3"/>
</files>
</folder>
</folder>
</index>
nodeSel = doc.SelectSingleNode"/index/folder[@Name='Test1']/
folder[@Name='Test2']/files/file[@Name='After You've Gone.mp3']");
Unfortunately that is difficult to achieve with XPath 1.0 as it does not
allow you to escape characters, rather all it allows is breaking up the
string into sequences you concatenate e.g.
doc.SelectSingleNode("/index/folder[@Name='Test1']/
folder[@Name='Test2']/files/file[@Name= concat('After You', \"'\", 've
Gone.mp3')]")
Thus if someone passes you the @Name value as a string you will have to
write code with C# that breaks up the string into pieces not containing
single quotes and containing single quotes to convert into one string
that uses the XPath concat function to concatenate pieces delimited by
single quotes with pieces delimited by double quotes as in the above
example.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/