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 1878
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: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |