0
프로젝트 폴더에 XML이 있습니다. 나는이XML 요소의 값 변경
XmlDocument doc = new XmlDocument();
string testFilesLocation = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string dataSource;
string xmlFileName = "Claim.txt";
if (System.IO.Directory.Exists(testFilesLocation + @"\Resources"))
{
dataSource = testFilesLocation + @"\Resources\" + xmlFileName;
}
else
{
dataSource = testFilesLocation + @"\" + xmlFileName;
}
doc.Load(dataSource);
XML을 사용하여 내용을로드하고하는 것은 노드
<ClaimKeyInfo>
<CompanyID>XXXX</CompanyID>
<ClaimNum>XX-XXXXX-XX<ClaimNum>
</ClaimKeyInfo>
<ClaimInfo>
<ClaimNum>XX-XXXXX-XX</ClaimNum>
<ClaimSensitivityInd>N</ClaimSensitivityInd>
<ClaimStatus>Open</ClaimStatus>
<ClaimInfo>
내가 ClaimNum 요소를 얻기 위해이 일을하고 있어요에게 다음과 같은있다
XmlElement root = doc.DocumentElement;
XmlNodeList elemList = root.GetElementsByTagName("ClaimNum");
for (int i = 0; i< elemList.Count; i++)
{
elemList[i].InnerXml = "YY-YYYYY-YY";
doc.Save(dataSource);
}
내가 elemList하지만 난의 요소를 모두받을 수 있나요 내부의 값을 변경할 수 없습니다.
도움을 주시면 감사하겠습니다.
노드의 값을 변경하려는 코드를 표시하십시오. – Tony