Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2015, 09:51 AM
Registered User
 
Join Date: Oct 2015
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default XPATH escape sequence character & Concat

I need to extract element from a document in case inner text node contains certain sequence of characters.
Ex: Test ' both " quotes"::LGC

So I used concat operator to join the string :
Value[@Name=\"concat(\"Test ' both \",'\" quotes\"::LGC')\"]"

But still SelectSingleNode operator return E-FAIL.

What I am missing here ?
 
Old October 7th, 2015, 10:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'm afraid your code might have come out a bit garbled.

It looks as if you are using XPath within some programming language where you are writing the XPath expression as a string literal in double quotes, and escaping the double quotes using the conventions of that host language. I assume also that you are using XPath 1.0.

Firstly, let's see what the XPath expression should look like:

Code:
Value[@Name=concat("Test ' both ",'" quotes"::LGC')]
Then, to put that in a string literal in your host language (if you haven't got some mechanism like C#'s verbatim string literals), you put a backslash before each quotation mark, and put the whole thing in quotes:

Code:
"Value[@Name=concat(\"Test ' both \",'\" quotes\"::LGC')]"
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
sandip_ware (October 8th, 2015)
 
Old October 8th, 2015, 02:07 AM
Registered User
 
Join Date: Oct 2015
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Thumbs up

Thanks Michael all your help & it resolve my issue.

Here is C++ code from Steven Engelhardt :
http://stevenengelhardt.com/tag/c-4/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert encoded characters with escape sequence (\u03c1) VerbatimBOT ASP.NET 3.5 Professionals 3 February 25th, 2011 09:44 AM
XSLT-escape-sequence sunilkswain XSLT 7 March 23rd, 2009 03:03 AM
how to send escape sequence to printer ergoktas C# 0 November 28th, 2006 04:36 AM
xslt issue to translate escape sequence rk2203 XSLT 2 October 13th, 2005 07:37 AM
Need Escape Character? shaileshmark SQL Server 2000 5 July 20th, 2004 12:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.