안녕하세요, XML에서 가치를 얻으려고하고 있지만 노드가 null 인 것으로 나타납니다.XML 파일에서 단일 노드 값을 읽는 방법
다음은 내 xml 파일입니다.
<?xml version="1.0" encoding="utf-8"?>
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.cfhdocmail.com/TestAPI2/Result.xsd https://www.cfhdocmail.com/TestAPI2/Result.xsd" xmlns="https://www.cfhdocmail.com/TestAPI2/Result.xsd">
<data>
<key>MailingGUID</key>
<value>0aa2b2e3-7afa-4002-ab2f-9eb4cbe33ae7</value>
</data>
<data>
<key>OrderRef</key>
<value>52186</value>
</data>
</result>
나는 "MailingGUID" 값을 얻을합니다. 내가 가 값을 MailingGUID 얻을 수있는 방법
이private void readXML()
{
XmlDocument xml = new XmlDocument();
// You'll need to put the correct path to your xml file here
xml.Load(Server.MapPath("~/XmlFile11.xml"));
// Select a specific node
XmlNode node = xml.SelectSingleNode("result/data/value");
// Get its value
string name = node.InnerText;
}
을 가르쳐주세요 : 여기
내가 시도 코드입니다.감사
문제가 XPath 쿼리 함께 : 나는 이것을 시도했다. 여기를보십시오 : [Link] (http://www.w3schools.com/xpath/) – Artless