M
mattdaddym
Hi all,
I've taken a couple of hours to read what is available, and I still
cannot figure out how to do a very simple task in vb .net...lol.
All I need to do is read an xml file and parse out specific information
based on simple criteria. Let's use this as the xml file:
<?xml version="1.0" encoding="utf-8" ?>
<sites>
<siteData>
<siteName>flux</siteName>
<active>true</active>
<email>[email protected]</email>
<email>[email protected]</email>
</siteData>
<siteData>
<siteName>capacitor</siteName>
<active>false</active>
<email>[email protected]</email>
</siteData>
<siteData>
<siteName>scott</siteName>
<active>true</active>
<email>[email protected]</email>
<email>[email protected]</email>
<email>[email protected]</email>
</siteData>
</sites>
I need to read out the email addresses as strings based on the
siteName.
I have seen at least 3 distinct ways to read xml.
1) Throw it into a dataset with DATASET.READXML
2) Use a xmldatareader XMLREADER.CREATE(BLAH,BLAH)
3) Instantiate on xmldocument and load the file in myXmlDoc as new
XmlDocument / myXmlDoc.Load(blah)
I can load the file and display it, but I am having trouble with the
syntax for reading out the value/innertext of one of the nodes based on
another node value. So here is what exactly I would like to do.
Traverse the xml file to the <siteData> node that contains whatever
<siteName> I specify. Then I need to iterate through the <email> nodes
(each site may have from 1 to 3 so I won't know how many)
Any help is greatly appreciated. Thanks!
I've taken a couple of hours to read what is available, and I still
cannot figure out how to do a very simple task in vb .net...lol.
All I need to do is read an xml file and parse out specific information
based on simple criteria. Let's use this as the xml file:
<?xml version="1.0" encoding="utf-8" ?>
<sites>
<siteData>
<siteName>flux</siteName>
<active>true</active>
<email>[email protected]</email>
<email>[email protected]</email>
</siteData>
<siteData>
<siteName>capacitor</siteName>
<active>false</active>
<email>[email protected]</email>
</siteData>
<siteData>
<siteName>scott</siteName>
<active>true</active>
<email>[email protected]</email>
<email>[email protected]</email>
<email>[email protected]</email>
</siteData>
</sites>
I need to read out the email addresses as strings based on the
siteName.
I have seen at least 3 distinct ways to read xml.
1) Throw it into a dataset with DATASET.READXML
2) Use a xmldatareader XMLREADER.CREATE(BLAH,BLAH)
3) Instantiate on xmldocument and load the file in myXmlDoc as new
XmlDocument / myXmlDoc.Load(blah)
I can load the file and display it, but I am having trouble with the
syntax for reading out the value/innertext of one of the nodes based on
another node value. So here is what exactly I would like to do.
Traverse the xml file to the <siteData> node that contains whatever
<siteName> I specify. Then I need to iterate through the <email> nodes
(each site may have from 1 to 3 so I won't know how many)
Any help is greatly appreciated. Thanks!