469,954 Members | 1,879 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

regexp needed: HTML to safe XML

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
2 1112
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
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.

Similar topics

1 post views Thread by andreas kirschner | last post: by
2 posts views Thread by Patryk Konieczka | last post: by
10 posts views Thread by Anand Pillai | last post: by
5 posts views Thread by Lukas Holcik | last post: by
1 post views Thread by ric.castagna | last post: by
2 posts views Thread by Tamas Nyilanszky | last post: by
3 posts views Thread by Russell | last post: by
4 posts views Thread by Matt | last post: by
4 posts views Thread by r | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.