Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XPath SelectSingleNode query with quotes problem.

From: Minerva Jones <junk@----.------>
To: NULL
Date: 5/8/2008 4:02:00 PM


I've got a problem reading in and searching through data where the
attributes might contain both single and/or double quotes. As they get
inserted into an XmlDocument, they get marked up with &quot; and
&apos; properly (which I can tell by looking at OuterXML), but then
using xPath to search for them is proving to be inconsistent. It's
like I can only write code that works for either double or single
quotes at time, depending on what I use to surround the data in the
query in the first place. All would be fine if using marked up code in
my queries worked, but it doesn't. So anyone know why this code
doesn't work:

XmlDocument xd = new XmlDocument();
XmlElement xe = xd.CreateElement("Element");
xe.SetAttribute("Attr", "Hello 'world'");
xd.AppendChild(xe);

xd.SelectSingleNode("//Element[@Attr=\"Hello 'world'\"]");
xd.SelectSingleNode("//Element[@Attr=\"Hello &apos;world&apos;\"]");


The first select works fine, but the second one fails. I'm led to
believe that they're a direct equivalent, so what's happening here?

Thanks for any help!


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent