Convert XML to VB.NET Dictionary

BuddyRevell

New Member
I'm trying to put sub-child values from XML into a dictionary collection using LINQ. I've done this with lists and custom collections which follow the same structure as the XML but am unable to search for specific values. If I know parentName, childName, and subChildName I want to be able to find subChildProperty1.value and subChildProperty2.value without iterating through the entire collection and each of the subsequent sub-collections, as I have to do with lists. This may not be the best implementation, and am open to suggestions, but still would like to figure out how to make this work. This would then allow me to have a dictionary item be:\[code\]key = "parentNameValue1.childNameValue1.subchildNameValue1.subChildProperty1"value = http://stackoverflow.com/questions/10804917/0\[/code\]and I could just concatenate strings to form a specific key and search on that key to return a value.XML:\[code\]<root> <parent> <parentName>parentNameValue1</parentName> <child> <childName>childNameValue1</childName> <subchild> <subchildName>subchildNameValue1</subchildName> <subChildProperty1>0</subChildProperty1> <subChildProperty2>5</subChildProperty2> </subchild> <subchild> <subchildName>subchildNameValue2</subchildName> <subChildProperty1>0</subChildProperty1> <subChildProperty2>10</subChildProperty2> </subchild> </child> </parent><root>\[/code\]This question is somewhat similar to this question here but I could not get the code working in VB for my application.I am new to SO (and VB) so I apologize if my etiquette is incorrect.
 
Back
Top