Xdocument를 사용하여 Windows 저장 응용 프로그램에서 xml을 구문 분석하려고합니다. Xdocument로 간단한 Xml 구문 분석
나는이 시도하지만, null를 반환XDocument xDoc;
string title= "";
xDoc = XDocument.Load(url);
var elements = from x in xDoc.Descendants()
select new
{
title = x.Descendants("title").First().Value,
};
foreach (var el in elements)
_title = title;
XML의 내용 :
<title type='text'>tiitle</title>
<content type='text'> gfgdgdggd</content>
<link rel='related' type='application/atom+xml' href='http....'/>
수는 속성의 텍스트를 가져 오지 얼마나?
명확히하십시오 -'title' 요소의 값이나'type' 속성의 값을 원하십니까? –
귀하의 XML이 유효하지 않습니다. 단일 루트 요소가 있어야합니다. –