I can't seem to get an xpath expression proper to get the references out of
the *.vbproj project file in VS2005.
the project is loaded into an XMLDocument
_dom = new xmldocument
_dom.load(pathToMyProjectFile)
dim myNodeList as XMLNodeList
myNodeList = _dom.selectNodes("some xpath expression that returns the
references"). ????
I have tried a lot of things but I just don't seem to get it. MyNodeList has
zero elements in it.
Thanks in advance,
jff 2 1894
Hi,
"Jeff Jarrell" <jj************@yahoo.com> wrote in message
news:ef**************@TK2MSFTNGP14.phx.gbl... I can't seem to get an xpath expression proper to get the references out of the *.vbproj project file in VS2005.
the project is loaded into an XMLDocument
_dom = new xmldocument _dom.load(pathToMyProjectFile)
dim myNodeList as XMLNodeList myNodeList = _dom.selectNodes("some xpath expression that returns the references"). ????
After having a look at the vb project file (VB2005Express/VC2005Beta2), it
looks like the root node has a default namespace (see xmlns="..." ). A
default namespace applies to the element and all child elements. (Child
elements can override the default namespace though.)
The path as in XPath, must be fully qualified, even when a namespace is a
default one.
Dim xdoc As New XmlDocument
xdoc.Load(pathToMyProjectFile)
' get default namespace and create a prefix for it
Dim xmlnsmgr As New XmlNamespaceManager(xdoc.NameTable)
xmlnsmgr.AddNamespace("d", xdoc.DocumentElement.NamespaceURI)
Dim nodes As XmlNodeList =
xdoc.SelectNodes("/d:Project/d:ItemGroup/d:Reference", xmlnsmgr)
For Each node As XmlNode In nodes
Console.WriteLine(node.Attributes("Include").Value )
Next
HTH,
Greetings I have tried a lot of things but I just don't seem to get it. MyNodeList has zero elements in it.
Thanks in advance, jff
Aha... Thank you.
jeff
"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP11.phx.gbl... Hi,
"Jeff Jarrell" <jj************@yahoo.com> wrote in message news:ef**************@TK2MSFTNGP14.phx.gbl...I can't seem to get an xpath expression proper to get the references out of the *.vbproj project file in VS2005.
the project is loaded into an XMLDocument
_dom = new xmldocument _dom.load(pathToMyProjectFile)
dim myNodeList as XMLNodeList myNodeList = _dom.selectNodes("some xpath expression that returns the references"). ????
After having a look at the vb project file (VB2005Express/VC2005Beta2), it looks like the root node has a default namespace (see xmlns="..." ). A default namespace applies to the element and all child elements. (Child elements can override the default namespace though.)
The path as in XPath, must be fully qualified, even when a namespace is a default one.
Dim xdoc As New XmlDocument xdoc.Load(pathToMyProjectFile)
' get default namespace and create a prefix for it Dim xmlnsmgr As New XmlNamespaceManager(xdoc.NameTable) xmlnsmgr.AddNamespace("d", xdoc.DocumentElement.NamespaceURI)
Dim nodes As XmlNodeList = xdoc.SelectNodes("/d:Project/d:ItemGroup/d:Reference", xmlnsmgr) For Each node As XmlNode In nodes Console.WriteLine(node.Attributes("Include").Value ) Next
HTH, Greetings
I have tried a lot of things but I just don't seem to get it. MyNodeList has zero elements in it.
Thanks in advance, jff
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: gael.pegliasco |
last post by:
Hi,
How are you dear and nice helper :) ?
I'm trying to test xpath with this simple program :
import xml.dom.minidom
from xml.xpath.Context import Context
import xml.xpath
|
by: Phoebian |
last post by:
Hi all,
Here is a little concept problem, and I need some guideline. I am
currently developing a application which delivers XML files. I want
then to sequentially perform some actions on...
|
by: Gismo |
last post by:
I have got file raport.rld which is an XML file generated by MS Reporting
Services.
The problem is:
in this file are tags from two different namespaces
...
|
by: trond |
last post by:
Hello all,
I am building a personal web site in VS2005 as a kind of learing
project for myself, so forgive me if this is a novice question.
I am planning to use an XML file called...
|
by: werD |
last post by:
Hello
I have an xml document that im currently using a forward only .net
repeater on and using some xpath queries to display the data
The xml is quite simple
<?xml version="1.0"...
|
by: Bilal |
last post by:
Hello,
I'm stuck on this problem for quite some time and hope somebody would
be able to guide me.
Basically, I need to populate a large number of "template" XML files
which have all...
|
by: abcd_68 |
last post by:
Hi there,
I'm using, for the first time, the JDK1.5 Xpath API. I need to find
elements in a Hibernate-generated .hbm.xml file. These files come with
a <!DOCTYPE header mentioning a remote URL....
|
by: rcronk |
last post by:
I'm new to C#/.NET. I am writing some C#/.NET (2.0) classes that will allow someone to get and set values in an XML file using an XPath to point to the location of that data. It's more complicated...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |