I have created the xml file (infopath form) from the template(xsn) programatically. I have the following xml file structure from the template file(xsn). Now I want to append values to the xml file.
<my:PropertyDetails>
<my:AddressSelectionList>2201.00000000000</my:AddressSelectionList>
<my:PropRef>210</my:PropRef>
<my:UPRN>2201.00000000000</my:UPRN>
<my:AddressLine>220 test road</my:AddressLine>
<my:PropId>210</my:PropId>
<my:BlockUPRN></my:BlockUPRN>
<my:Attachments xsi:nil="true"></my:Attachments>
<my:Filegroup>
<my:URL></my:URL>
<my:URLText></my:URLText>
</my:Filegroup>
</my:PropertyDetails>
<my:ScaffoldMeasure>
<my:groupRepeat>
<my:Description></my:Description>
<my:Code></my:Code>
<my:Unit></my:Unit>
<my:Rate xsi:nil="true"></my:Rate>
<my:Quantity></my:Quantity>
<my:Cost xsi:nil="true"></my:Cost>
<my:Comments></my:Comments>
<my:ID></my:ID>
<my:Title></my:Title>
</my:groupRepeat>
</my:ScaffoldMeasure>
<my:PorchBalcony>
<my:groupRepeat>
<my:Description></my:Description>
<my:Code></my:Code>
<my:Unit></my:Unit>
<my:Rate xsi:nil="true"></my:Rate>
<my:Quantity></my:Quantity>
<my:Cost xsi:nil="true"></my:Cost>
<my:Comments></my:Comments>
<my:ID></my:ID>
<my:Title></my:Title>
</my:groupRepeat>
</my:PorchBalcony>
I am trying to access as follows:
> XmlNodeList properNodeList =
> xmlDoc.GetElementsByTagName("my:PropertyDetails");
> XmlNodeList smNodeList = xmlDoc.GetElementsByTagName("my:ScaffoldMeasure");
var a= new XElement(
myns + "groupRepeat",
from c in xmlDoc.Elements(nsm + "ScaffoldMeasure") select
new XElement(nsm + "groupRepeat",
new XElement(nsm + "Description", "scaffold1"),
new XElement(nsm + "Code", "sc1"),
new XElement(nsm + "Unit", "sc1"),
new XElement(nsm + "Rate", "sc1"),
new XElement(nsm + "Quantity", "sc1"),
new XElement(nsm + "Cost", "sc1"),
new XElement(nsm + "Comments", "sc1"),
new XElement(nsm + "ID", "sc1"),
new XElement(nsm + "Title", "ssssssss")));
xmlDoc.Save(@"C:\ttt.xml");
Now I need to append the values in the groupRepeat section. Can anybody suggest whats the best way to append values to the section?
Thanks