XML encode method?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sosh

    XML encode method?

    Hi,

    I was wondering if there is a method in the XML classes that allows
    you to encode a string so it is safe to stick in an XML file? I would
    have thought so, but can't find it. Please tell me I don't have to do
    a replace for each of the dissallowed characters!!

    Thanks
  • Martin Honnen

    #2
    Re: XML encode method?


    Sosh wrote:
    [color=blue]
    > I was wondering if there is a method in the XML classes that allows
    > you to encode a string so it is safe to stick in an XML file? I would
    > have thought so, but can't find it. Please tell me I don't have to do
    > a replace for each of the dissallowed characters!![/color]

    XmlTextWriter has plenty of methods to create well-formed XML.

    --

    Martin Honnen --- MVP XML

    Comment

    • Mihai N.

      #3
      Re: XML encode method?

      > XmlTextWriter has plenty of methods to create well-formed XML.
      And if you really don't want to use anything from .NET and want do do your
      own, there are only 2 characters that are not ok: '<' and '&'


      --
      Mihai Nita [Microsoft MVP, Windows - SDK]
      ------------------------------------------
      Replace _year_ with _ to get the real email

      Comment

      • Sosh

        #4
        Re: XML encode method?

        No, I don't really want to. But it doesn't look so bad when you put
        it like that.
        [color=blue][color=green]
        >> XmlTextWriter has plenty of methods to create well-formed XML.[/color]
        >And if you really don't want to use anything from .NET and want do do your
        >own, there are only 2 characters that are not ok: '<' and '&'[/color]

        Comment

        Working...