MSXML - SelectNodes and XPath
I'm getting a parsing error returned when executing the xpath statement. Below is the code I am using.
-------------------------------------------------
Dim matchText : matchText="<span style='font-size:12pt; font-family:""Times New Roman""; color:#000000;'>file</span>"
...
...
Set identNodeList = itemNode.selectNodes("/item[text=""" & matchText & """]/@ident")
-------------------------------------------------
The error I get is:
------------------------------------------------
Expected token ']' found 'NAME'.
/item/text="<span style='font-size:12pt; font-family:"-->Times<--New Roman"; color:#000000;'>file</span>"]/@ident
------------------------------------------------
It seems like the quote before the text "Times" is being treated as a closing quote. I need these quotes to be part of the string I am searching for. I also tried replacing the double quotes with the escape character " as follows:
------------------------------------------------
Dim matchText : matchText="<span style='font-size:12pt; font-family:"Times New Roman"; color:#000000;'>file</span>"
...
...
Set identNodeList = itemNode.selectNodes("/item[text=""" & matchText & """]/@ident")
------------------------------------------------
The above code executes without error but it does not select any nodes.
My question is, how do you build a xpath query that contains single and double quotes as the value you are looking for?
Please advise.
|