AvalonEdit - XMLFolding -> Игнорировать первую строку
Можно ли будет игнорировать первую строку при попытке обновить складывания?
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, и читатель выдаст исключение.
1 ответ
Решение
Следующая пропустит первую строку
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);
}
}
}