Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. question about xml and C#

question about xml and C#

Scheduled Pinned Locked Moved C#
csharpxmlhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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

    H 1 Reply Last reply
    0
    • A Anonymous

      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

      H Offline
      H Offline
      hooray
      wrote on last edited by
      #2

      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.

      D 1 Reply Last reply
      0
      • H hooray

        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.

        D Offline
        D Offline
        DavidNohejl
        wrote on last edited by
        #3

        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

        H 1 Reply Last reply
        0
        • D DavidNohejl

          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

          H Offline
          H Offline
          hooray
          wrote on last edited by
          #4

          yeah - that right.Thanks for the correction. that was my mistake because I only thought of the language specific umlauts.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups