Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 13th, 2006, 01:25 PM
glbdev@yahoo.com
Guest
 
Posts: n/a
Default XML node selection error

I am trying to select a node in an XML file for deletion. I am using
the following code to select the node:

set node = XmlDoc.selectSingleNode("/dataroot/MainNode[Value = '" +
sSearchCriteria + "']")

Unfortunately, the string "sSearchCriteria" can contain apostrophes
which causes this error:

Error Type:
msxml3.dll (0x80004005)
Expected token ']' found 'STRING'. /dataroot/MainNode[Value =
'Steve'-->'s Auto Parts'<--]

I've tried the "Replace" function to add double, triple, etc
apostrophes but nothing works.

The data in the XML file is not being created by me, and is being used
in several different apllications, so I cannot change it.

Any suggestions?

  #2  
Old December 13th, 2006, 01:45 PM
Anthony Jones
Guest
 
Posts: n/a
Default Re: XML node selection error


<glbdev@yahoo.comwrote in message
news:1166017533.939164.154790@j72g2000cwa.googlegr oups.com...
Quote:
I am trying to select a node in an XML file for deletion. I am using
the following code to select the node:
>
set node = XmlDoc.selectSingleNode("/dataroot/MainNode[Value = '" +
sSearchCriteria + "']")
Try :-


set node = XmlDoc.selectSingleNode("/dataroot/MainNode[Value = '" &
Replace(sSearchCriteria,"'","&apos;") & "']")


Quote:
>
Unfortunately, the string "sSearchCriteria" can contain apostrophes
which causes this error:
>
Error Type:
msxml3.dll (0x80004005)
Expected token ']' found 'STRING'. /dataroot/MainNode[Value =
'Steve'-->'s Auto Parts'<--]
>
I've tried the "Replace" function to add double, triple, etc
apostrophes but nothing works.
>
The data in the XML file is not being created by me, and is being used
in several different apllications, so I cannot change it.
>
Any suggestions?
>

  #3  
Old December 13th, 2006, 02:45 PM
glbdev@yahoo.com
Guest
 
Posts: n/a
Default Re: XML node selection error

Anthony,

Thanks for the reply. Unfortunately, it did not work. This is what the
string looks like after the replace: "Steve&apos;s Auto Parts". Is
this correct?

- Gary


Anthony Jones wrote:
Quote:
<glbdev@yahoo.comwrote in message
news:1166017533.939164.154790@j72g2000cwa.googlegr oups.com...
Quote:
I am trying to select a node in an XML file for deletion. I am using
the following code to select the node:

set node = XmlDoc.selectSingleNode("/dataroot/MainNode[Value = '" +
sSearchCriteria + "']")
>
Try :-
>
>
set node = XmlDoc.selectSingleNode("/dataroot/MainNode[Value = '" &
Replace(sSearchCriteria,"'","&apos;") & "']")
>
>
>
Quote:

Unfortunately, the string "sSearchCriteria" can contain apostrophes
which causes this error:

Error Type:
msxml3.dll (0x80004005)
Expected token ']' found 'STRING'. /dataroot/MainNode[Value =
'Steve'-->'s Auto Parts'<--]

I've tried the "Replace" function to add double, triple, etc
apostrophes but nothing works.

The data in the XML file is not being created by me, and is being used
in several different apllications, so I cannot change it.

Any suggestions?
 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles