Код: Выделить всё
CSX Atlanta Division Abbeville Sub
The Abbeville Subdivision runs from Tucker, GA to Abbeville, SC. It is a CTC-line, single track with passing sidings. There are four road trains, coal, grain, ethanol, and local traffic.
The Abbeville Subdivision was originally part of the Seaboard Air Line Railroad. With the creation of CSX in the early 1980s, the Abbeville Sub has remained a part of CSX since.
По какой-то причине XmlReader пропускает теги. Он прочитает тег имени, затем пропустит описание, а затем прочитает историю.
Это код считывателя и константы:
Код: Выделить всё
public class Constants
{
public class Tags
{
public const string NAME = "name";
public const string DESC = "description";
public const string NOTES = "notes";
public const string TYPE = "type";
public class RouteTags
{
public const string ROUTE = "route";
public const string HISTORY = "history";
public const string HISTORYLINK = "historylink";
public const string INDUSTRY = "industry";
public const string LOCATIONINFO = "locationinfo";
}
}
public void ReadXML(XmlReader textReader)
{
while (textReader.Read())
{
if(textReader.Name == Constants.Tags.NAME && textReader.IsStartElement())
{
Name = textReader.ReadElementContentAsString();
}
else if (textReader.Name == Constants.Tags.DESC && textReader.IsStartElement())
{
Description = textReader.ReadElementContentAsString();
}
else if (textReader.Name == Constants.Tags.RouteTags.HISTORY && textReader.IsStartElement())
{
History = textReader.ReadElementContentAsString();
}
else if(textReader.Name == TAG && !textReader.IsStartElement())
{
return;
}
}
}
Мне удалось заставить это прочитать только вручную добавив пробелы между тегами, либо встроенно, либо после выполнения «красивой печати» в Notepad++. Одним из требований этой программы является возможность читать уже написанный XML без вмешательства пользователя.
Подробнее здесь: https://stackoverflow.com/questions/791 ... tween-them
Мобильная версия