I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
and I've tried
"SomeNode[SomeAttribute = 'abc@quot;s search'"
And neither one of these gives me a result.
Note, because of the structure and the way this XPATH is put together, I
would prefer to not have to use double quotes as the delimiters for the
search string, I'd like to keep it single quotes.
How to make this query find my node? 8 21482
Marina Levit [MVP] wrote:
I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
Assuming you actually meant '...
<xsl:variable name="apos">
<xsl:text>'</xsl:text>
</xsl:variable>
<xsl:if test="SomeNode[SomeAttribute = concat('abc',$a pos,'s search')]">
....
///Peter
--
XML FAQ: http://xml.silmaril.ie/
But I have an XPATH expression and I am searching for a node. How does what
you wrote fit into that?
"Peter Flynn" <pe********@m.s ilmaril.iewrote in message
news:4r******** ****@mid.indivi dual.net...
Marina Levit [MVP] wrote:
>I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
Assuming you actually meant '...
<xsl:variable name="apos">
<xsl:text>'</xsl:text>
</xsl:variable>
<xsl:if test="SomeNode[SomeAttribute = concat('abc',$a pos,'s search')]">
...
///Peter
--
XML FAQ: http://xml.silmaril.ie/
Marina Levit [MVP] wrote:
I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
and I've tried
"SomeNode[SomeAttribute = 'abc@quot;s search'"
And neither one of these gives me a result.
Note, because of the structure and the way this XPATH is put together, I
would prefer to not have to use double quotes as the delimiters for the
search string, I'd like to keep it single quotes.
How to make this query find my node?
In what context are you using the XPath? If that is an XSLT stylesheet
then using entity references like ' or " might help but if you
have .NET code (e.g. C# or VB.NET) then using those XML entity
references is not possible.
As for that escape problem, it is ugly, XPath 1.0 itself does not have
any escape mechanism so you need to split strings e.g. C# string literal
to be passed to SelectSingleNod e looks like
@"SomeNode[@SomeAttribute = concat('abc', ""'"", 's search')]"
See also Oleg's blog
<http://www.tkachenko.c om/blog/archives/000627.htmlresp ectively the
XPathCache API the MVP XML project provides.
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Oy... what a headache.
The problem with this approach is that I can't just escape the characters.
There is a ton of code that already assumes there are single quote
delimiters to the search string. All that would have to be changed.
Using the jscript XML object model this all works without a problem. And
yet, .NET can't implement an XML DOM that works half way decent.
Thanks
"Martin Honnen" <ma*******@yaho o.dewrote in message
news:e%******** ********@TK2MSF TNGP03.phx.gbl. ..
Marina Levit [MVP] wrote:
>I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
and I've tried
"SomeNode[SomeAttribute = 'abc@quot;s search'"
And neither one of these gives me a result.
Note, because of the structure and the way this XPATH is put together, I would prefer to not have to use double quotes as the delimiters for the search string, I'd like to keep it single quotes.
How to make this query find my node?
In what context are you using the XPath? If that is an XSLT stylesheet
then using entity references like ' or " might help but if you
have .NET code (e.g. C# or VB.NET) then using those XML entity references
is not possible.
As for that escape problem, it is ugly, XPath 1.0 itself does not have any
escape mechanism so you need to split strings e.g. C# string literal to be
passed to SelectSingleNod e looks like
@"SomeNode[@SomeAttribute = concat('abc', ""'"", 's search')]"
See also Oleg's blog
<http://www.tkachenko.c om/blog/archives/000627.htmlresp ectively the
XPathCache API the MVP XML project provides.
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Marina Levit [MVP] wrote:
Using the jscript XML object model this all works without a problem. And
yet, .NET can't implement an XML DOM that works half way decent.
I am not sure why you think it is a .NET issue. What exactly are you
doing with JScript and MSXML that you can't do with .NET and C# (or VB.NET)?
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Querying a dom to locate certain nodes where a string literal has a single
quote in it.
This works perfectly in MSXML, as apparently that uses an XSL pattern query
(not that I really know exactly what that is), which is apparently more
flexible, and allows this to actually work.
..NET follows the XPATH 1.0 standard, which apparently isn't as useful,
meaning I can't have single quotes in literals when searching for nodes in a
DOM.
"Martin Honnen" <ma*******@yaho o.dewrote in message
news:eF******** ********@TK2MSF TNGP03.phx.gbl. ..
Marina Levit [MVP] wrote:
>Using the jscript XML object model this all works without a problem. And yet, .NET can't implement an XML DOM that works half way decent.
I am not sure why you think it is a .NET issue. What exactly are you doing
with JScript and MSXML that you can't do with .NET and C# (or VB.NET)?
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Marina Levit [MVP] wrote:
But I have an XPATH expression and I am searching for a node. How does what
you wrote fit into that?
What I wrote. I just copied your sample XPath expression.
I'm not sure I understand what the difficulty is.
///Peter
--
XML FAQ: http://xml.silmaril.ie/
"Peter Flynn" <pe********@m.s ilmaril.iewrote in message
news:4r******** ****@mid.indivi dual.net...
>Marina Levit [MVP] wrote:
>>I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'"
Assuming you actually meant '...
<xsl:variabl e name="apos"> <xsl:text>'</xsl:text> </xsl:variable> <xsl:if test="SomeNode[SomeAttribute = concat('abc',$a pos,'s search')]"> ...
///Peter -- XML FAQ: http://xml.silmaril.ie/
You want me to use the XSL as an XPATH expression?
I think concat on its own works fine. The problem is, like I said, I didn't
want to have to change the delimiters which are single quotes everywhere.
Which I would have to do, so the concat doesn't end up as a literal.
I expected to be able to do a replace in the search string to escape the
single quotes, so single quotes can remain the delimiters for the literal.
"Peter Flynn" <pe********@m.s ilmaril.iewrote in message
news:4r******** ****@mid.indivi dual.net...
Marina Levit [MVP] wrote:
>But I have an XPATH expression and I am searching for a node. How does what you wrote fit into that?
What I wrote. I just copied your sample XPath expression.
I'm not sure I understand what the difficulty is.
///Peter
--
XML FAQ: http://xml.silmaril.ie/
>"Peter Flynn" <pe********@m.s ilmaril.iewrote in message news:4r******* *****@mid.indiv idual.net...
>>Marina Levit [MVP] wrote: I've scoured google, but apparently none of the suggestions actually work.
I have the following. type of XPATH query
"SomeNode[SomeAttribute = 'abc's search'"
Now, I've tried doing this:
"SomeNode[SomeAttribute = 'abc@apos;s search'" Assuming you actually meant '...
<xsl:variab le name="apos"> <xsl:text>'</xsl:text> </xsl:variable> <xsl:if test="SomeNode[SomeAttribute = concat('abc',$a pos,'s search')]"> ...
///Peter -- XML FAQ: http://xml.silmaril.ie/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TheKeith |
last post by:
Hi, I'm just learning php now for the first time and I'm having a little
trouble understanding something.
In the following example:
------------------------------------------------------------------------
<?php
function test ($thenum) {
|
by: Leif B. Kristensen |
last post by:
I'm working with a Python program to insert / update textual data into a
PostgreSQL database. The text has single and double quotes in it, and I
wonder: What is the easiest way to escape quotes in Python, similar to
the Perlism "$str =~ s/()/\\$1/g;"?
I tried the re.escape() method, but it escapes far too much, including
spaces and accented characters. I only want to escape single and double
quotes, everything else should be acceptable...
|
by: JehanNYNJ |
last post by:
I have to put some html into a variable like so....
var html = '<TABLE cellspacing="5" border="0" .......
But within this html string I also need to have the code for a button
that traps the onclick method like so...
....<input type="button" name="Add Question" value="Repeat Question"
onclick="javascript:getQuestion( '3925','38497', '1' )" >....';
|
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">
</Authors>
|
by: Jeff S |
last post by:
In a VB.NET code behind module, I build a string for a link that points to a
JavaScript function. The two lines of code below show what is relevant.
PopupLink = "javascript:PopUpWindow(" & Chr(34) & PopUpWindowTitle & Chr(34)
& ", " & Chr(34) & CurrentEventDetails & ")"
strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName &
"</A><BR>"
The problem I have is that when the string variables or
contain a string with an...
| |
by: Axel Dahmen |
last post by:
Hi,
within a DataGrid control I'm using a DataTable containing a string column
to fill a Hyperlink's href attribute. Unfortunately HttpUtility.UrlEncode()
doesn't escape the apostroph character, thus ruining some of my hrefs.
How do I correctly escape any character using a Page's current encoding (I
don't want to hard-code the encoding)?
TIA,
|
by: Lawrence D'Oliveiro |
last post by:
The "escape" function in the "cgi" module escapes characters with special
meanings in HTML. The ones that need escaping are '<', '&' and '"'.
However, cgi.escape only escapes the quote character if you pass a second
argument of True (the default is False):
'the "quick" & <brown> fox'
'the "quick" & <brown> fox'
This seems to me to be dumb. The default option should be the safe one: that
is, escape _all_ the potentially troublesome...
|
by: Confused but working on it |
last post by:
Hi all,
I'm trying to do something simple and grabbed a snippet from the php
manual for reading files in a directory. The snippet echos out a nice
list of files.
<?php
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
|
by: crybaby |
last post by:
I wrote a python code in linux text pad and copied to thumb drive and
try to ran the file by changing the path to windows:
sys.path = sys.path +
I get the following error:
ValueError: invalid \x escape
I am pretty sure this problem is due some kind of linux end of line
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |