我有下面的XML文檔和有一個稱爲在側<FormData>
該標籤它作爲一個屬性稱爲FormId =「d617a5e8-b49b-4640-9734-bc7a2bf05691」的標籤如何更改XML文檔中屬性的值?
我想改變該值在C#代碼?
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(MapPath(tempFolderPathAlt + "dvforms" + "\\XmlDataTemplate.xml"));
//Change value of FormID
xmlDoc.Save(tempFolderPath + "data.xml");
要爲我的XML文檔:
<?xml version="1.0"?>
<FormData Platform="Android" PlatformVersion="100" Version="966" DataVersion="1" Description="Investec - Res" FormId="d617a5e8-b49b-4640-9734-bc7a2bf05691" FileId="e6202ba2-3658-4d8e-836a-2eb4902d441d" EncryptionVerification="" CreatedBy="Bob" EditedBy="Bob">
<FieldData>
<request_details_export_template Mod="20010101010101" IncludeInPDFExport="Yes"></request_details_export_template>
<request_details_reason_for_valuatio Mod="20010101010101" IncludeInPDFExport="Yes"></request_details_reason_for_valuatio>
</FieldData>
<Photos Mod="20010101010101"/>
<VoiceNotes/>
<Drawings Mod="20010101010101"/>
<FieldNotes/>
</FormData>
+1推薦的XPath,有大量的信息穀歌在XPaths上,它通常比試圖遍歷每個節點更好。 –
非常感謝+1 – Pomster