Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Want to Convert my XML into a Key Value Pair or as a Dictionary.

$
0
0

Hi,

Below is my XML structure.

<MyData>

<Data>

<Name>Test1</Name>

<Value>Pass</Value>

<ID>1</ID>

</Data>

<Data>

<Name>Test2</Name>

<Value>Fail</Value>

<ID>2</ID>

</Data>

<Data>

<Name>Test3</Name>

<Value>DependentFailed</Value>

<ID>3</ID>

</Data>

</MyData>

I want to convert this into a dictionary while converting using XML Serializer.

Want only Name and Value fields as Key (Name) and Value(Value).

Class structure will be

Class MyData

{

[XmlElement]

public Dictionary<string,string> Data {get;set;}

}

What attributes i have to specify in XmlElement Tag to achieve this!!?


Viewing all articles
Browse latest Browse all 935

Trending Articles