XML: & --> &

L

Leszek

Hi,

I believe there is in the .NET Library a method to convert a given string
containing not allowed characters (such as & or <) in XML files to
corresponding domains (&amp; etc).

Where can I find such a utility methods?

Thanks,
Leszek Taratuta
 
R

Robert Rossney

: Hi,
:
: I believe there is in the .NET Library a method to convert a given string
: containing not allowed characters (such as & or <) in XML files to
: corresponding domains (&amp; etc).
:
: Where can I find such a utility methods?

I'd just use the XmlDocument to do it. Create an XmlDocument object, load
in an empty element of known name length, and then set the DocumentElement's
InnerText property. Then examine the appropriate characters of its OuterXml
property, which will include all of the characters nicely escaped into
entities.

Of course, if there's actually a method somewhere that does this, that's
even better.

Bob Rossney
(e-mail address removed)
 
T

Tian Min Huang

Hi Leszek,

I believe the KB article 316063 below is helpful:

HOW TO: Locate and Replace Special Characters in an XML File with Visual C#
.NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;316063

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top