I have a question about how to read through an XML Document
Here is an example of a similar XML to what I am using
where the id corresponds with the first letter of their last name.
I want to be able to search through an xml and match it up to a name, and if the last name I am searching matches the first letter, which is the attribute, to look at the child nodes, to see if the full last name matches.
so basically if I were to search Bush, it would completely skip Chuck Norris (which is probably not possible due to the physical prowess but anyway), and go to the bush entry, see the attribute matches the first character of the name being searched, and then look through the child nodes, and then save them as strings to an array or something.
I tried messing with XmlTextReader and its components but can not really figure out what will do what I want and how to get it to not look farther into each element and its corresponding nodes.
Thanks in advance for your help!
Here is an example of a similar XML to what I am using
Code:
<People>
<Person id = "n">
<LastName>Norris</LastName>
<FirstName>Chuck</FirstName>
<Hobby>badassery</Hobby>
</Person>
<Person id = "b">
<LastName>Bush</LastName>
<FirstName>George</FirstName>
<Hobby>Dumbassery</Hobby>
</Person>
</People>
I want to be able to search through an xml and match it up to a name, and if the last name I am searching matches the first letter, which is the attribute, to look at the child nodes, to see if the full last name matches.
so basically if I were to search Bush, it would completely skip Chuck Norris (which is probably not possible due to the physical prowess but anyway), and go to the bush entry, see the attribute matches the first character of the name being searched, and then look through the child nodes, and then save them as strings to an array or something.
I tried messing with XmlTextReader and its components but can not really figure out what will do what I want and how to get it to not look farther into each element and its corresponding nodes.
Thanks in advance for your help!
Comment