How do I get a string array of these xml values?

tehfatguy

New Member
I was attempting to use linq to xml, but I'm pretty new to it.This is the xml:\[code\]<BrandHosts> <Brand> <ResourceName>BrandInfo_AAA</ResourceName> <Hosts> <Host>www.aaa.com</Host> <Host>portal.aaa.com</Host> <Host>aaa.com</Host> </Hosts> </Brand> <Brand> <ResourceName>BrandInfo_BBB</ResourceName> <Hosts> <Host>www.bbb.com</Host> <Host>bbb.com</Host> <Host>portal.bbb.com</Host> </Hosts> </Brand> <Brand> <ResourceName>BrandInfo_CCC</ResourceName> <Hosts> <Host>www.CCC.com</Host> </Hosts> </Brand> <Brand> <ResourceName>BrandInfo_DDD</ResourceName> <Hosts> <Host>www.DDD.com</Host> </Hosts> </Brand></BrandHosts>\[/code\]I will have a string value that has the resource name of what I need to pull out of this xml. So my parameter, for example, might be "BrandInfo_BBB". And I would need to return a string array containing all of the hosts from that block. Can I do this with linq to xml?
 
Back
Top