This is my XML
<MilestoneCollection> <Milestone> <Description>Departure from Origin</Description> <EventCode>DEP</EventCode> <Sequence>1</Sequence> <ActualDate></ActualDate> <ConditionReference>LOC=<FirstLeg.Origin></ConditionReference> <ConditionType>RFP</ConditionType> <EstimatedDate>2015-05-10T18:07:00</EstimatedDate> </Milestone> <Milestone> <Description>Departure from Origin</Description> <EventCode>DEP</EventCode> <Sequence>1</Sequence> <ActualDate></ActualDate> <ConditionReference>LOC=<FirstLeg.Origin></ConditionReference> <ConditionType>RFP</ConditionType> <EstimatedDate>2015-05-10T18:07:00</EstimatedDate> </Milestone> <Milestone> <Description>Arrival at Destination</Description> <EventCode>ARV</EventCode> <Sequence>2</Sequence> <ActualDate></ActualDate> <ConditionReference>LOC=<LastLeg.Destination></ConditionReference> <ConditionType>RFP</ConditionType> <EstimatedDate>2015-05-11T14:02:00</EstimatedDate> </Milestone> <Milestone> <Description>Arrival at Destination</Description> <EventCode>ARV</EventCode> <Sequence>2</Sequence> <ActualDate></ActualDate> <ConditionReference>LOC=<LastLeg.Destination></ConditionReference> <ConditionType>RFP</ConditionType> <EstimatedDate></EstimatedDate> </Milestone> </MilestoneCollection>
This is my current code. I need to Edit the 1st, 2nd, or 3rd Milestone. I don't know how exactly the syntax for that. How do i edit element Milestone[0] something like this.
XDocument doc = XDocument.Load(sample.xml); var xmldocu = doc.Descendants("MilestoneCollection");
No comments:
Post a Comment