Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 7th, 2015, 09:51 AM
Registered User
Points: 58, Level: 1
Points: 58, Level: 1 Points: 58, Level: 1 Points: 58, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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 ?
Reply With Quote
  #2 (permalink)  
Old October 7th, 2015, 10:21 AM
mhkay's Avatar
Wrox Author
Points: 18,252, Level: 58
Points: 18,252, Level: 58 Points: 18,252, Level: 58 Points: 18,252, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,929
Thanks: 0
Thanked 281 Times in 276 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
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
sandip_ware (October 8th, 2015)
  #3 (permalink)  
Old October 8th, 2015, 02:07 AM
Registered User
Points: 58, Level: 1
Points: 58, Level: 1 Points: 58, Level: 1 Points: 58, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08: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 03: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



All times are GMT -4. The time now is 07:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.