I have a XML file with settings. I would like to read the the name and valueof all CollectionEntry nodes and add them to a DataGrid.
I think a good way is to use a List and fill it with the name and values of the XML file and then add it to the DataGrid, like this:
List<Buffer> buffers = new List<Buffer>(); buffers.Add(new Buffer(){bufferName="username_testuser1",bufferValue="testuser2"}); bufferGrid.DataSource = buffers; public class Buffer { public string bufferName { get; set; } public string bufferValue { get; set; } } But how can I read the specific CollectionEntry values? This is the XML file:
<?xml version="1.0" encoding="utf-8"?> <Settings xmlns="Namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Category name="Commander"> <Category name="ManualTestExecution"> <Setting name="WindowLocation" legacyPath="Commander.GUI.ManualTestExecution.WindowLocation">336,263</Setting> <Setting name="WindowSize" legacyPath="Commander.GUI.ManualTestExecution.WindowSize">732,451</Setting> </Category> </Category> <Category name="Engine"> <Setting name="Key Delay" legacyPath="BaseSettings.keyDelay">1</Setting> <Setting name="Wait Intermediate" legacyPath="BaseSettings.waitIntermediate">5000</Setting> <Setting name="Report Successful Execution of" legacyPath="XML.OutputLogLevel">2</Setting> <Collection name="Buffer" legacyPath="Buffer.Local"> <CollectionEntry name="username_testuser1">testuser2</CollectionEntry> <CollectionEntry name="password_testuser1">!Welcome099</CollectionEntry> <CollectionEntry name="username_testuser2">testuser2</CollectionEntry> </Collection> </Category> </Settings>
No comments:
Post a Comment