question about xml and C#
-
hello i am trying to write some characters to an xml file in strings that arent good in an xml file specificly & i realize you can replace this with & and i read about the function HtmlEncode on msdn my question is were do i find this function or is it set someplace in my xmltextwriter object please help me out
-
hello i am trying to write some characters to an xml file in strings that arent good in an xml file specificly & i realize you can replace this with & and i read about the function HtmlEncode on msdn my question is were do i find this function or is it set someplace in my xmltextwriter object please help me out
as far as I know does the xmlwriter nothing like this - because xml supports different encodings it is not neccessary to htmlEncode the string. But if you wish to use the HtmlEncode function you can use it the following way. string str = System.Web.HttpUtility.HtmlEncode("bye"); To have access to the System.Web Namespace you need to add a new reference (System.Web.dll) to your project.
-
as far as I know does the xmlwriter nothing like this - because xml supports different encodings it is not neccessary to htmlEncode the string. But if you wish to use the HtmlEncode function you can use it the following way. string str = System.Web.HttpUtility.HtmlEncode("bye"); To have access to the System.Web Namespace you need to add a new reference (System.Web.dll) to your project.
hooray wrote: because xml supports different encodings it is not neccessary to htmlEncode the string. Let me correct you,
HtmlEncode
has nothing to do with "different encodings" ( here I assume you mean UTF, ASCII etc) but problem is that at least characters < > & etc. has special meaning in XML, and they cannot be in XML document in literal form. You have to either wrap 'em into CDATA or "enocde/escape" them as character enties - e.g. &, <...HtmlEncode
does exactly this kind of "encoding". David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy -
hooray wrote: because xml supports different encodings it is not neccessary to htmlEncode the string. Let me correct you,
HtmlEncode
has nothing to do with "different encodings" ( here I assume you mean UTF, ASCII etc) but problem is that at least characters < > & etc. has special meaning in XML, and they cannot be in XML document in literal form. You have to either wrap 'em into CDATA or "enocde/escape" them as character enties - e.g. &, <...HtmlEncode
does exactly this kind of "encoding". David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy