By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,386 Members | 1,705 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,386 IT Pros & Developers. It's quick & easy.

List of XPath Escape Characters

P: n/a
In my previous post, I asked about a routine which prepares a string for
an XPath query by taking care of escape characters.
Unable to find a list, I'm now wondering assumign I enclose the
attribute value in quotes in my XPath query, what other escape
characters need to be handled aside from a quotation mark? As I
understand it, an apostrophe wouldn't be a problem since I'm enclosing
the string in quotes.
thanks!

Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Matthew,

For a list of these special characters, you may refer to:

HOW TO: Locate and Replace Special Characters in an XML File with Visual
Basic .NET
http://support.microsoft.com/default...b;EN-US;308060

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 11 '05 #2

P: n/a
In attribute value you still can not literally use (&), because (&)
indicates the start of entity reference. Instead you must use (&),
Besides, as you already knew, if you want to use inside attribute value,
then you have to pay special attention not to use the one you deliminate the
attribute value. For example, you said you are using quotation (") to
enclose your attribute value, then you must escape it inside the attribute
value, otherwise, the XmlReader or XmlDocument will recognize it as the end
of the attribute value.But you can still use (').

If you want to do preparation for Xml source file, the list of special
characters is here:
Character Name Entity Reference Character Reference Numeric Reference
Ampersand & & &
Left angle bracket &lt; < &#60;
Right angle bracket &gt; > >
Straight quotation mark &quot; " '
Apostrophe &apos; ' "
Among the 5, (>), ("), and (') has been handled by the XmlReader and the
XmlDocument objects because only single character replacement is required
for these characters. The VB code you see on the page from the link in last
email actually don't do much more than escaping (&) and the 2nd (<).

HTH,
Jun Wang

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
"MSFT" <lu******@online.microsoft.com> wrote in message
news:ts*************@cpmsftngxa06.phx.gbl...
Hi Matthew,

For a list of these special characters, you may refer to:

HOW TO: Locate and Replace Special Characters in an XML File with Visual
Basic .NET
http://support.microsoft.com/default...b;EN-US;308060

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--
"Matthew Wieder" <De*********@SatoriGroupInc.com> wrote in message
news:3F**************@SatoriGroupInc.com... In my previous post, I asked about a routine which prepares a string for
an XPath query by taking care of escape characters.
Unable to find a list, I'm now wondering assumign I enclose the
attribute value in quotes in my XPath query, what other escape
characters need to be handled aside from a quotation mark? As I
understand it, an apostrophe wouldn't be a problem since I'm enclosing
the string in quotes.
thanks!

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.