![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi group, I've written a program which uses this XPath query: //*[contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ ", \"abcdefghijklmnopqrstuvwxyz\"),"SomeString"] as you better know, it finds and locates "SomeString" under any path within an xml file. The thing is that I don't know how to make it ignore those nodes which have children and focus on nodes that have a text only. Like: Parent> ignore LastChild>SomeString</LastChild> OK /Parent> ignore |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
You can use the text() function to evaluate only the text inside your nodes this xpath expression show it's use: //*[contains(text(),'SomeString')] Hope this helps. Gauthier Segay C# newbie wrote: Hi group, I've written a program which uses this XPath query: //*[contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ ", \"abcdefghijklmnopqrstuvwxyz\"),"SomeString"] as you better know, it finds and locates "SomeString" under any path within an xml file. The thing is that I don't know how to make it ignore those nodes which have children and focus on nodes that have a text only. Like: Parent> ignore LastChild>SomeString</LastChild> OK /Parent> ignore |
#5
| |||
| |||
|
|
Hello, C#! You wrote on Thu, 8 Apr 2004 16:03:58 -0700: Cn> I've written a program which uses this XPath query: Cn> //*[contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ ", Cn> \"abcdefghijklmnopqrstuvwxyz\"),"SomeString"] Cn> as you better know, it finds and locates "SomeString" under any path Cn> within an xml file. Cn> The thing is that I don't know how to make it ignore those nodes which Cn> have children and focus on nodes that have a text only. //*[not(*)][contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ ", Cn> \"abcdefghijklmnopqrstuvwxyz\"),"SomeString"] With best regards, Alex Shirshov. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |