473,230 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

XPath for attributes with single and double quotes

In my XML document, some node attributes data contains both single quot
and double quote characters, such as

<input msg="Hello "World", What's up"/>.

The double quotes are in form of escape sequence in the XML document.
am not able to locate such elements using an XPath expression. I trie
the following:

//*[@msg="Hello "World", What's up"]
Failes with string error at double quote before World

//*[@msg='Hello "World", What's up']
Failes with string error at single quote after What

//*[@msg="Hello "World", What's up"]
I used the escpase sequence for double quote in my xpath which you ar
seeing as acutal double quote in this post.
No Error but does not return any node.

//*[@msg="Hello "World", What's up"]
I used the escpase sequence for both double quotes and single quotes i
my xpath which you are seeing as acutal double quote and single quotesi
this post
No Error but does not return any node

I tried both MSXML 3.0 and MSXML 4.
Any Ideas?
-
giris
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message103989.htm

Jul 20 '05 #1
2 14361
In article <bd******************************@news.thenewsgrou ps.com>,
girish <gi***********@mail.forum4designers.com> wrote:
In my XML document, some node attributes data contains both single quote
and double quote characters [...]I am not able to locate such elements using an XPath expression.


Yes, annoying isn't it. You can't write an XPath string literal
that contains both kinds of quote.

You can construct the string by breaking it into pieces that use only
one kind of quote, and concatenating them using concat:

//*[@msg=concat('Hello "World", What', "'s up")]

If you're using this expression in a XML attribute (e.g. in an XSLT
stylesheet) you'll still need to escape whichever kind of quote is
used for the attribute value.

-- Richard
Jul 20 '05 #2
girish wrote:
In my XML document, some node attributes data contains both single quote
and double quote characters, such as

<input msg="Hello "World", What's up"/>.

The double quotes are in form of escape sequence in the XML document. I
am not able to locate such elements using an XPath expression. I tried
the following:

//*[@msg="Hello "World", What's up"]
Failes with string error at double quote before World

//*[@msg='Hello "World", What's up']
Failes with string error at single quote after What

//*[@msg="Hello "World", What's up"]
I used the escpase sequence for double quote in my xpath which you are
seeing as acutal double quote in this post.
No Error but does not return any node.

//*[@msg="Hello "World", What's up"]
I used the escpase sequence for both double quotes and single quotes in
my xpath which you are seeing as acutal double quote and single quotesin
this post
No Error but does not return any node

I tried both MSXML 3.0 and MSXML 4.
Any Ideas??


&quot; is your friend.

///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
1
by: Alastair Cameron | last post by:
VB6, MSXML 3.2 installed: Q1. I am having a problem selecting nodes with XPATH expressions when an attribute values contain backslashes (\\) in as part of its value: For example the...
3
by: Kevin | last post by:
I know this has probably been discussed many times before (I found answers when I searched yesterday), but I still can't get it to work... I have an attribute @OID that can contain any...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
2
by: Matthew Wieder | last post by:
Does someone have the routine (preferablly in C#) that takes a string (i.e. "3995 Joseph, Smith "Joe") and prepares it for use in an XPath query ( i.e. SelectSingleNode(/member) ) so that all...
7
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned...
4
by: Greg | last post by:
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith">...
4
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.