Не получается прочитать документ XML - C#
Формулировка задачи:
Есть документ. Пытаюсь его прочитать
ничего не получается.
Хотя таким же кодом другой документ читается. Подскажите, что не так тут.
Во вложении проект с двумя документами XML (который читается и который не читается)
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://portal.rosreestr.ru/xsl/GKN/Vidimus/06/common.xsl"?>
<KVZU xmlns="urn://x-artefacts-rosreestr-ru/outgoing/kvzu/6.0.9" xmlns:smev="urn://x-artefacts-smev-gov-ru/supplementary/commons/1.0.1" xmlns:num="urn://x-artefacts-rosreestr-ru/commons/complex-types/numbers/1.0" xmlns:adrs="urn://x-artefacts-rosreestr-ru/commons/complex-types/address-output/3.0.1" xmlns:spa="urn://x-artefacts-rosreestr-ru/commons/complex-types/entity-spatial/2.0.1" xmlns:cer="urn://x-artefacts-rosreestr-ru/commons/complex-types/certification-doc/1.0" xmlns:doc="urn://x-artefacts-rosreestr-ru/commons/complex-types/document-output/3.0.1" xmlns:nobj="urn://x-artefacts-rosreestr-ru/commons/complex-types/natural-objects/1.0.1">
<Parcels>
<Parcel CadastralNumber="36:28:8200017:23" State="06" DateCreated="2011-03-22">
<CadastralBlock>36:28:8200017</CadastralBlock>
<Name>01</Name>
<Area>
<Area>56095</Area>
<Unit>055</Unit>
<Inaccuracy>2072</Inaccuracy>
</Area>
<Location>
<inBounds>1</inBounds>
<Placed>Д6</Placed>
<Address>
<adrs:OKATO>20249000000</adrs:OKATO>
<adrs:KLADR>3602900000000</adrs:KLADR>
<adrs:Region>36</adrs:Region>
<adrs:District Name="Семилукский" Type="р-н" />
<adrs:Other>в южной части кадастрового квартала 36:28:8200017</adrs:Other>
</Address>
</Location>
<Category>003001000000</Category>
<Utilization ByDoc="Для сельскохозяйственного производства" />
<Rights>
<Right>
<Name>Собственность</Name>
<Type>001001000000</Type>
<Owners>
<Owner>
<Governance>
<Name>Воронежская область</Name>
</Governance>
</Owner>
</Owners>
<Registration>
<RegNumber>36-36-29/060/2011-595</RegNumber>
<RegDate>2011-12-15</RegDate>
</Registration>
</Right>
</Rights>
<EntitySpatial EntSys="ID0">
<spa:SpatialElement>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="1">
<spa:Ordinate X="528788.05" Y="1256524.95" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="2">
<spa:Ordinate X="528784.83" Y="1256374.76" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="3">
<spa:Ordinate X="528755.14" Y="1256371.99" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="4">
<spa:Ordinate X="528772.74" Y="1256195.26" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="5">
<spa:Ordinate X="529005.1" Y="1256227.58" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="6">
<spa:Ordinate X="528998.17" Y="1256269.49" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="7">
<spa:Ordinate X="528986.94" Y="1256326.97" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="8">
<spa:Ordinate X="528920.7" Y="1256385.3" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="9">
<spa:Ordinate X="528929.45" Y="1256481.34" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="10">
<spa:Ordinate X="528861.26" Y="1256525.9" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
<spa:SpelementUnit TypeUnit="Точка" SuNmb="1">
<spa:Ordinate X="528788.05" Y="1256524.95" OrdNmb="1" DeltaGeopoint="2.5" />
</spa:SpelementUnit>
</spa:SpatialElement>
</EntitySpatial>
<Encumbrances>
<Encumbrance>
<Type>022006000000</Type>
<OwnersRestrictionInFavorem>
<OwnerRestrictionInFavorem>
<Organization>
<Name>Общество с ограниченной ответственностью "Русское поле"</Name>
</Organization>
</OwnerRestrictionInFavorem>
</OwnersRestrictionInFavorem>
<Duration>
<Started>2013-10-01</Started>
<Stopped>2016-09-30</Stopped>
</Duration>
<Registration>
<RegNumber>36-36-29/067/2013-180</RegNumber>
<RegDate>2013-12-09</RegDate>
</Registration>
</Encumbrance>
</Encumbrances>
<CadastralCost Value="385411.92" Unit="383" />
</Parcel>
</Parcels>
<CertificationDoc>
<cer:Organization>Федеральный информационный ресурс</cer:Organization>
<cer:Date>2016-02-04</cer:Date>
<cer:Number>99/2016/2004744</cer:Number>
</CertificationDoc>
<CoordSystems>
<spa:CoordSystem Name="СК кадастрового округа" CsId="ID0" />
</CoordSystems>
</KVZU>
textBox1.Clear();
XmlDocument xDoc = new XmlDocument();
xDoc.Load(@"C:\_TEMP\1\myxml_4 (гкн с коорд) 1.xml");
XmlNode root = xDoc.DocumentElement;
XmlNodeList nodes = root.SelectNodes("Parcels");
foreach (XmlNode node in nodes)
{
textBox1.AppendText(node.OuterXml + Environment.NewLine);
}Решение задачи: «Не получается прочитать документ XML»
textual
Листинг программы
XmlDocument xDoc = new XmlDocument();
xDoc.Load("myxml_4 (гкн с коорд) 1.xml");
// Регистрация префиксов для пространств имен
XmlNamespaceManager nsManager = new XmlNamespaceManager(xDoc.NameTable);
nsManager.AddNamespace("kvzu", "urn://x-artefacts-rosreestr-ru/outgoing/kvzu/6.0.9");
XmlNode root = xDoc.DocumentElement;
XmlNodeList nodes = root.SelectNodes("kvzu:Parcels", nsManager);
foreach (XmlNode node in nodes)
{
textBox1.AppendText(node.OuterXml + Environment.NewLine);
}