Suppose I have this XML document...
<root>
  <str name="My node's attribute">My string's value</str>
</root>
I want to get the value of the "str" element based on a known value of the elements "name" attribute so I use the following XPath query...
str[@name='My node's attribute']
But that doesn't work for me at least not in classic ASP and C# because of the si开发者_StackOverflow中文版ngle quote which of course conflicts with the single quotes used in XPath syntax. An exception is thrown in both cases.
What is a possible solution here if I have the restriction that I can't change the XML document.
Use " in the xpath instead:-
C#
 string xpath = "str[@name=\"My node's attribute\"]";
VBScript
 Dim xpath : xpath = "str[@name=""My node's attribute""]"
str[@name='My node's attribute']
Try:
str[@name='My node''s attribute']
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论