Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to replace single quote, when using MSXML parser..?

Posted on 2003-03-19
8
Medium Priority
?
259 Views
Last Modified: 2010-05-18
I am trying to select a node through xpath query, which has the single quote, throwing error.

Appreciate any sort of help.
0
Comment
Question by:rgodavarthi
7 Comments
 
LVL 9

Expert Comment

by:sparkplug
ID: 8172568
Do you have an example?

>S'Plug<
0
 
LVL 9

Expert Comment

by:sparkplug
ID: 8172723
0
 
LVL 1

Expert Comment

by:xsl-lsx
ID: 8174414
<xsl:stylesheet>

<xsl:param name="q1">'</xsl:param>
<xsl:param name="q2">"</xsl:param>

...
<xsl:attribute name="onmouseover">
     <xsl:text>return !showPopup("nameFieldPopup", event,</xsl:text>
     <xsl:choose>
          <xsl:when test="contains(OBJ_DESC,$q1)">
               <xsl:value-of select="$q2"/>
               <xsl:value-of select="OBJ_DESC"/>
               <xsl:value-of select="$q2"/>
          </xsl:when>
          <xsl:when test="contains(OBJ_DESC,$q2)">
               <xsl:message terminate="yes">
                    has both " and ' within
                    <xsl:value-of select="OBJ_DESC"/>
               </xsl:message>
          </xsl:when>
          <xsl:otherwise>
               <xsl:value-of select="$q1"/>
               <xsl:value-of select="OBJ_DESC"/>
               <xsl:value-of select="$q1"/>
          </xsl:otherwise>
     </xsl:choose>
     <xsl:text>);</xsl:text>
</xsl:attribute>

</xsl:stylesheet>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:rgodavarthi
ID: 8175339
My code:

Node = CurrentSectionNode.selectSingleNode("//Indication[Content = '" + strSelectedContent + "']");

strSelectedContent is string variable, which has single quote.

I'm using MSXML4 parser.

Thanks.
0
 

Author Comment

by:rgodavarthi
ID: 8175363
My code:

Node = CurrentSectionNode.selectSingleNode("//Indication[Content = '" + strSelectedContent + "']");

strSelectedContent is string variable, which has single quote.

I'm using MSXML4 parser.

Thanks.
0
 
LVL 9

Expert Comment

by:sparkplug
ID: 8177971
Try:

strSelectedContent = Replace(strSelectedContent, "'", "&apos;")

>S'Plug<
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12563538
PAQed with no points refunded (of 250)

modulo
Community Support Moderator
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question