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. Removing the XML heading line in C#.

Removing the XML heading line in C#.

Scheduled Pinned Locked Moved C#
csharptutorialxmlquestion
3 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.
  • S Offline
    S Offline
    Segal
    wrote on last edited by
    #1

    I'm pretty new to .NET and XML here, and now I want to write a program in C# to remove the heading line from input XML file. For example, my input XML file will look sth. like this: - xxxxx yyyyyyyy. .............. Now, I want modify this file and remove the first line "", so the modified file will be: - xxxxx yyyyyyyy. .............. Can anybody advise me how to do it? Thanks!

    L 1 Reply Last reply
    0
    • S Segal

      I'm pretty new to .NET and XML here, and now I want to write a program in C# to remove the heading line from input XML file. For example, my input XML file will look sth. like this: - xxxxx yyyyyyyy. .............. Now, I want modify this file and remove the first line "", so the modified file will be: - xxxxx yyyyyyyy. .............. Can anybody advise me how to do it? Thanks!

      L Offline
      L Offline
      Le centriste
      wrote on last edited by
      #2

      Read the file line by line, and throw away the first line.

      H 1 Reply Last reply
      0
      • L Le centriste

        Read the file line by line, and throw away the first line.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        If you're talking about the pre-processing line or a DOCTYPE, that would work. However, if you're talking about removing the root element, you should read-in the document as an XmlDocument, get the child node(s) of the DocumentElemnt, and write those out to a file.


        Reminiscent of my younger years... 10 LOAD "SCISSORS" 20 RUN

        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