Is it me, or is XML navigation in VB a little more convoluted than it "needs" to be?
I was a little excited to see that XPath was a part of the VB toolbox, but I'm a little confused as to why I'm getting the results that I am.
My xml file:
And what I'd like to do is on program startup, get the basedir, store it, get each node in primDir, subDir, and files and store in a List.
Relevant VB code:
The output for above:
E:\wamp\wwwassetsstaticimagesheaderlinksjscssPSDindex.phpcolor.csslayout.csstype.css
(which is clearly everything in the xml file, whereas I just want "E:...")
It seems a lot of the XML articles out there are either "iterate ALL nodes" or a repeat of another site, so it's becoming difficult to find different examples to extrapolate from.
I'm just not familiar with how vb.net works just yet, and this is just head scratcher.
I was a little excited to see that XPath was a part of the VB toolbox, but I'm a little confused as to why I'm getting the results that I am.
My xml file:
VB.NET:
<?xml version="1.0"?>
<cfg>
<basedir>E:\wamp\www</basedir>
<initial>
<primDir>
<dir>assets</dir>
<dir>static</dir>
<dir>images</dir>
</primDir>
<subDir>
<dir parent="assets">header</dir>
<dir parent="assets">links</dir>
<dir parent="static">js</dir>
<dir parent="static">css</dir>
<dir parent="images">PSD</dir>
</subDir>
<files>
<file>index.php</file>
<file parent="static">color.css</file>
<file parent="static">layout.css</file>
<file parent="static">type.css</file>
</files>
</initial>
</cfg>
And what I'd like to do is on program startup, get the basedir, store it, get each node in primDir, subDir, and files and store in a List.
Relevant VB code:
VB.NET:
Dim config As New XPathDocument(CFG)
Dim nav As XPathNavigator
Dim ni As XPathNodeIterator
nav = config.CreateNavigator()
ni = nav.Select("basedir")
Debug.WriteLine(ni.Current.Value)
The output for above:
E:\wamp\wwwassetsstaticimagesheaderlinksjscssPSDindex.phpcolor.csslayout.csstype.css
(which is clearly everything in the xml file, whereas I just want "E:...")
It seems a lot of the XML articles out there are either "iterate ALL nodes" or a repeat of another site, so it's becoming difficult to find different examples to extrapolate from.
I'm just not familiar with how vb.net works just yet, and this is just head scratcher.