XML save issue in .NET

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

    #1

    XML save issue in .NET

    Hi,

    Currently we are using the .NET XMLDocument Class to manipulate some xml
    documents. The issue we are having is that when we save the XML files using
    the classes save method, empty xml tags will be saved with a CRLF instead of
    the empty value. This can be solved by setting the PreserveWhiteSp ace
    property to true. But then the indentation is lost.

    E.g.:-
    Before Saving this is how the tags are.

    <Test></Test>

    After saving

    <Test>
    </Test>


    Has anybody come across this, is there any solution for this.

    Thanks
    Amendra.



  • Oleg Tkachenko

    #2
    Re: XML save issue in .NET

    Amendra wrote:

    [color=blue]
    > Currently we are using the .NET XMLDocument Class to manipulate some xml
    > documents. The issue we are having is that when we save the XML files using
    > the classes save method, empty xml tags will be saved with a CRLF instead of
    > the empty value. This can be solved by setting the PreserveWhiteSp ace
    > property to true. But then the indentation is lost.[/color]

    You have to choose what to preserve - either indentation of whitespace.
    Alternatively implement your own indentation algorithm.
    --
    Oleg Tkachenko

    Multiconn Technologies, Israel

    Comment

    • Amendra

      #3
      Re: XML save issue in .NET

      Is this the only solution.. :(


      "Oleg Tkachenko" <oleg@NO_!SPAM! _PLEASEtkachenk o.com> wrote in message
      news:ewVTMkZlDH A.1408@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Amendra wrote:
      >
      >[color=green]
      > > Currently we are using the .NET XMLDocument Class to manipulate some xml
      > > documents. The issue we are having is that when we save the XML files[/color][/color]
      using[color=blue][color=green]
      > > the classes save method, empty xml tags will be saved with a CRLF[/color][/color]
      instead of[color=blue][color=green]
      > > the empty value. This can be solved by setting the PreserveWhiteSp ace
      > > property to true. But then the indentation is lost.[/color]
      >
      > You have to choose what to preserve - either indentation of whitespace.
      > Alternatively implement your own indentation algorithm.
      > --
      > Oleg Tkachenko
      > http://www.tkachenko.com/blog
      > Multiconn Technologies, Israel
      >[/color]


      Comment

      • Chris Lovett

        #4
        Re: XML save issue in .NET

        Set IsEmpty on XmlElement to true.

        "Amendra" <amendra@virtus a.com> wrote in message
        news:uht%23Sg5k DHA.3256@tk2msf tngp13.phx.gbl. ..[color=blue]
        > Hi,
        >
        > Currently we are using the .NET XMLDocument Class to manipulate some xml
        > documents. The issue we are having is that when we save the XML files[/color]
        using[color=blue]
        > the classes save method, empty xml tags will be saved with a CRLF instead[/color]
        of[color=blue]
        > the empty value. This can be solved by setting the PreserveWhiteSp ace
        > property to true. But then the indentation is lost.
        >
        > E.g.:-
        > Before Saving this is how the tags are.
        >
        > <Test></Test>
        >
        > After saving
        >
        > <Test>
        > </Test>
        >
        >
        > Has anybody come across this, is there any solution for this.
        >
        > Thanks
        > Amendra.
        >
        >
        >[/color]


        Comment

        • Daniel Neto

          #5
          Re: XML save issue in .NET

          Dear friends,

          This groups is an Brasilian Group, in Portuguese Language all rights??!!!

          Abs,
          Daniel Neto



          "Amendra" <amendra@virtus a.com> escreveu na mensagem
          news:uht%23Sg5k DHA.3256@tk2msf tngp13.phx.gbl. ..[color=blue]
          > Hi,
          >
          > Currently we are using the .NET XMLDocument Class to manipulate some xml
          > documents. The issue we are having is that when we save the XML files[/color]
          using[color=blue]
          > the classes save method, empty xml tags will be saved with a CRLF instead[/color]
          of[color=blue]
          > the empty value. This can be solved by setting the PreserveWhiteSp ace
          > property to true. But then the indentation is lost.
          >
          > E.g.:-
          > Before Saving this is how the tags are.
          >
          > <Test></Test>
          >
          > After saving
          >
          > <Test>
          > </Test>
          >
          >
          > Has anybody come across this, is there any solution for this.
          >
          > Thanks
          > Amendra.
          >
          >
          >[/color]


          Comment

          Working...