question
및 answer
값을 C#을 사용하여 가져오고 싶지만 그 전에 필요한 ID를 얻고 싶습니다. 나는이 XML을 사용하고 있습니다 :C# XML 노드 값 가져 오기
<root>
<information>
<name>Tasks</name>
<date>15-05-2005</date>
</information>
<tasks>
<task>
<id>1</id>
<question>Here comes question 1</question>
<answer>Answer 1</answer>
</task>
<task>
<id>2</id>
<question>Here comes question 2</question>
<answer>Answer 2</answer>
</task>
<task>
<id>3</id>
<question>Here comes question 3</question>
<answer>Answer 3</answer>
</task>
</root>
C# 코드를 :
XDocument tasks;
int TheIdINeed = 2;
string quest = "";
string answ = "";
폼로드시 :
tasks = XDocument.Load(leveltoload);
var status = tasks.Element("level").Element("information");
quest = tasks.Element("root").Element("tasks").Element("task").Element("question").Value; // It returns me the first task data, but I need to load data with required Id (int TheIdINeed = ...)
미안 해요, 내 영어가 좋지 않다. 이 범위 이외의 질문과 답변을해야하는 경우
완벽한 영어 당신은 항상 나에게 분을 구입 이길 – Savage