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

regexp needed: HTML to safe XML

P: n/a
I need a regular expression to convert reserved XML characters in an HTML
stream to their safe XML equivalent. Can it be done w/ one expression?
Here's the list:

" = "
' = '
< = &lt;
= &gt;

= = &eq;
& = &amp;

Thanks,

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


P: n/a
In article <eo**************@tk2msftngp13.phx.gbl>,
so*****@microsoft.com says...
I need a regular expression to convert reserved XML characters in an HTML
stream to their safe XML equivalent. Can it be done w/ one expression?


Try the HttpUtility.HTMLEncode method. I think that will handle the
characters you listed.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2

P: n/a
In article <eo**************@tk2msftngp13.phx.gbl>,
so*****@microsoft.com says...
I need a regular expression to convert reserved XML characters in an HTML
stream to their safe XML equivalent. Can it be done w/ one expression?


Try the HttpUtility.HTMLEncode method. I think that will handle the
characters you listed.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.