I have a string which basically contains an XML file, with tags and everything.
One tag I'm particularly interested in, is <address source>
.
The thing is, the XML file isn't always the same. Sometimes there might just be one tag <address source>
present, sometimes there may be 5 of them present, and sometimes even 20 or more.
So, imagine my string is something like this:
string XMLToAnalyze = "<XML><TAG1>somecontent</TAG1><address source>content</address source><address source>content</address source><TAG2>morecontent</TAG2></XML>"`
So, in this particular string, there's two times the tag <address source>
.
What I need, is this:
I need to find the Index (or IndexOf) of each tag <address source>
, and I need these indexes stored separately, preferably truly in separate integers (one integer per index), or alternatively in an array. This is because I'll need to access each separate integer to fill in some fields in a Winforms form.
Is this possible?