Removing the XML heading line in C#.
-
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!
-
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!
Read the file line by line, and throw away the first line.
-
Read the file line by line, and throw away the first line.
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 theDocumentElemnt
, and write those out to a file.
Reminiscent of my younger years... 10 LOAD "SCISSORS" 20 RUN