1
linq xDocument 사용 요소가 부모 외부에 있는지 확인하고 싶습니다.C# XDocument 요소가 부모 요소 외부에 있습니다.
샘플 XML : 예상
<document>
<x>
<p>text</p>
</x>--this is correct
<p>some text</p> --this should be inside <x> tag
<x>
<p>text</p>
</x>--this is correct
</document>
는 :
<document>
<x>
<p>text</p>
</x>
<x>
<p>some text</p>
<p>text</p>
</x>
</document>
VAR 노드 =의 xdoc.Descendants() 요소 ("아이") 여기서 (X => x.Parent .Name.LocalName! = "parent"); -있어 .. 고마워 모두 – Chaegie
xdoc.Descendants ("child") 비트를 줄일 수 있습니다. (..) –