fersrgvsdg
New Member
I have problem i'm trying to update a specific part of the XML with the linq query but it doesn't work. So i an xml file:\[code\]<?xml version="1.0" encoding="utf-8"?><DesignConfiguration> <Design name="CSF_Packages"> <SourceFolder>C:\CSF_Packages</SourceFolder> <DestinationFolder>C:\Documents and Settings\xxx</DestinationFolder> <CopyLookups>True</CopyLookups> <CopyImages>False</CopyImages> <ImageSourceFolder>None</ImageSourceFolder> <ImageDesinationFolder>None</ImageDesinationFolder> </Design></DesignConfiguration>\[/code\]I want to select the part where the part where there is \[code\]Design name="somethning"\[/code\] and get the descendants and then update the descendants value that means this part:\[code\] <SourceFolder>C:\CSF_Packages</SourceFolder> <DestinationFolder>C:\Documents and Settings\xxx</DestinationFolder> <CopyLookups>True</CopyLookups> <CopyImages>False</CopyImages> <ImageSourceFolder>None</ImageSourceFolder> <ImageDesinationFolder>None</ImageDesinationFolder>\[/code\]I have this code: \[code\] XDocument configXml = XDocument.Load(configXMLFileName); var updateData = http://stackoverflow.com/questions/12816102/configXml.Descendants("DesignConfiguration").Elements().Where(el => el.Name == "Design" && el.Attribute("name").Value.Equals("CSF_Packages")).FirstOrDefault(); configXml.Save(configXMLFileName);\[/code\]I'm getting the null data in the \[code\]updateData\[/code\] varibale. When I'm trying the Descendat's function through QuickWatch it also returns a null value. When I'm checking the configXML variable it has data that is my whole xml. What am I doing wrong?