尝试更新折叠时是否可以忽略第一行?
Ignore this line
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</Ffrom>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
现在,这不被识别为有效的XMLDocument,读者将抛出异常。
答案 0 :(得分:0)
以下将跳过第一行
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
const string FILENAME = @"c:\temp\test.xml";
static void Main(string[] args)
{
StreamReader reader = new StreamReader(FILENAME);
reader.ReadLine(); // skip first line
XDocument doc = XDocument.Load(reader);
}
}
}