I have created a xml file from a dataset, but the first node is <NewDataset> i need to change that to <FormData> and i also need to add in some parameter like Platform=”Android” and Version=”488″.
Is there any way to change it while it is still a dataset or will i have to call up the file after i change it and then save it?
My knowledge of data files is minimal and i really need some help.
Current xml file
<NewDataSet>
<FieldData>
<property_details_gps_location>-29.77861, 31.008617</property_details_gps_location>
<property_details_address_address1>27 MANJEE</property_details_address_address1>
<property_details_address_address2>KENVILLE</property_details_address_address2>
<property_details_address_city>ETHEKWINI</property_details_address_city>
<property_details_address_state>KWAZULU NATAL</property_details_address_state>
</FieldData>
</NewDataSet>
What i hope to achive:
<FormData Platform="Android" PlatformVersion="73" Version="488" DataVersion="1" Description="Investec - Res" FormId="d617a5e8-b49b-4640-9734-bc7a2bf05691" FileId="bce3a788-6725-4ce2-b965-1b55c6e7cc95" EncryptionVerification="" CreatedBy="Shaunm" EditedBy="Shaunm">
<FieldData>
<property_details_gps_location>-29.77861, 31.008617</property_details_gps_location>
<property_details_address_address1>27 MANJEE</property_details_address_address1>
<property_details_address_address2>KENVILLE</property_details_address_address2>
<property_details_address_city>ETHEKWINI</property_details_address_city>
<property_details_address_state>KWAZULU NATAL</property_details_address_state>
</FieldData>
</FormData>
You can easily modify/add elements/attributes via LINQ to XML.
To list the child nodes,