XML: & --> &

  • Thread starter Thread starter Leszek
  • Start date Start date
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
 
: 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)
 
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.
 
Back
Top