Thank you for taking a look at my post.
I am working with an XML file that repeats nodes. I can get information from the nodes however I can't seem to keep it together due to a secondary repeating node. I have been able to use xdoc.Decendants("GROUP") and loop through each element to get the first 5 nodes. However I am running into trouble retrieving the areas/area tags. I tested nesting a xdoc.decendants (Not the best option
) but this returns all the data with that tag. I also looked at XMLDocument Select Nodes, but that has the same result.
How can I get just the data between the "group" tags? Could I get a nudge in the right direction.
Thank you for your time.
Paul
Dim AlertsRec = xdoc.Descendants("ALERT")
'Then loop through each element in a for each statement.
I am working with an XML file that repeats nodes. I can get information from the nodes however I can't seem to keep it together due to a secondary repeating node. I have been able to use xdoc.Decendants("GROUP") and loop through each element to get the first 5 nodes. However I am running into trouble retrieving the areas/area tags. I tested nesting a xdoc.decendants (Not the best option
How can I get just the data between the "group" tags? Could I get a nudge in the right direction.
Thank you for your time.
Paul
tested this too:
Dim xdoc As XDocument = XDocument.Load(strFile)
Dim AlertsRec = xdoc.Descendants("GROUP")
'Then loop through each element in a for each statement.
Dim xDom As New XmlDocument
xDom.Load(strData)
Dim MyNodeList As XmlNodeList
Dim LocationsNodeList As XmlNodeList
Dim LocationNodeData As XmlNodeList
MyNodeList = xDom.SelectNodes("/GROUPS/GROUP")
Dim AlertsRec = xdoc.Descendants("ALERT")
'Then loop through each element in a for each statement.
XML structure:
<GROUPS>
<GROUP>
<CAPTION>Data</CAPTION>
<CLEAN-CAPTION>Clean Data</CLEAN-CAPTION>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
<CRAWL>Text</CRAWL>
<MESSAGE>More detailed text</MESSAGE>
<AREAS>
<AREA>
<NAME>a place</NAME>
<PLACE>Location</PLACE>
<STREET>Street Name</STREET>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
</AREA>
<AREA>
<NAME>a place</NAME>
<PLACE>Location</PLACE>
<STREET>Street Name</STREET>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
</AREA>
<AREA>
<NAME>a place</NAME>
<PLACE>Location</PLACE>
<STREET>Street Name</STREET>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
</AREA>
</AREAS>
</GROUP>
<GROUP>
<CAPTION>Data</CAPTION>
<CLEAN-CAPTION>Clean Data</CLEAN-CAPTION>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
<CRAWL>Text</CRAWL>
<MESSAGE>More detailed text</MESSAGE>
<AREAS>
<AREA>
<NAME>a place</NAME>
<PLACE>Location</PLACE>
<STREET>Street Name</STREET>
<EXPIRATION-TIME>Date in ZULU</EXPIRATION-TIME>
</AREA>
</AREAS>
</GROUP>
</GROUPS>