# XML Path - Node not found error

**URL:** https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191
**Category:** Discussion
**Created:** [September 7, 2006, 11:09am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191 "2006-09-07T11:09:56Z")
**Posts on this page:** 8
**Page:** 2

<div class="post-metadata">

### Author: ![ken\_turner](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/7993a0/32.png) [@ken\_turner](https://www.finalbuilder.com/forums/u/ken_turner)
#### Post date: [September 25, 2006, 9:35am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/21 "2006-09-25T09:35:01Z")

</div>

Tate:  
  
I have tried to attach my XML file, which is called HRPAYROLLRecon.csproj, but I get the message Invalid file type or file exceeds max size(300kb).  
  
I’ll email it to you separately.  
  
Not much point in sending the FB project, since it is only a single action, as illustrated in my first post above.  
  
Meanwhile, I’ve tried it with your latest test build, and produced identical results  
  
Ken

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [September 26, 2006, 4:12am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/22 "2006-09-26T04:12:43Z")

</div>

Thanks for sending the file Ken.  
  
Figured out that the problem was to do with a default namespace being used in the xml file. To use xpath when there’s a default namespace in the xml document, you need to turn on the “Expand namespace prefixes…” checkbox on the MSXML Parser property page, and then specify a namespace prefix of whatever you want, eg. “a” (without quotes)  
  
Then in your xpath, you need to prefix any node you specify with the namespace, eg.  
/a:Project/a:PropertyGroup[contains(@Condition, ‘Release’)]/a:OutputPath  
  
Here’s the Microsoft Knowledge Base article that describes the solution:  
[http://support.microsoft.com/kb/313372/en-us](http://support.microsoft.com/kb/313372/en-us)  
  
cheers,  
.t8

---

<div class="post-metadata">

### Author: ![ken\_turner](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/7993a0/32.png) [@ken\_turner](https://www.finalbuilder.com/forums/u/ken_turner)
#### Post date: [September 26, 2006, 11:25am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/23 "2006-09-26T11:25:59Z")

</div>

Tate you’re a megastar!!! Thanks a million for that.  
  
OK Here’s another wrinkle:  
  
I set up another Read XML Value to Variable action, using the same source file, with the value /Project in the Xpath box and xlmns in the Read an Attrribute box. This worked fine in MSXML3, but reports ‘XPath returned no node : /Project’ with MSXML4.  
  
Any thoughts about that?  
  
And finally …  
  
For reasons beyond my control, my development machine has a professional FinalBuilder licence, but my production machine has only got a standard licence, so the XML actions aren’t available in production. OK, no problem, a few lines of VBScript should do the trick:  
  
set xmlDoc=CreateObject(“Microsoft.XMLDOM”)  
xmlDoc.async = False  
xmldoc.setProperty “SelectionLanguage”, "XPath"  
xmlDoc.load(“Q:\Support\HR-PAYROLL Reconciliation\HRPAYROLL Recon\HRPAYROLLRecon.csproj”)  
xmldoc.setProperty “SelectionNamespaces”, “xmlns:a=‘[http://schemas.microsoft.com/developer/msbuild/2003](http://schemas.microsoft.com/developer/msbuild/2003)’“  
set node = xmlDoc.documentElement.selectsinglenode(”/a:Project/a:PropertyGroup[contains(@Condition, ‘Release’)]/a:OutputPath”)  
Msgbox node.text  
  
This works OK, but has the xmlns attribute hard wired into the code; I can’t figure out how to make it generic.  
  
Apologies, Tate, this is no longer a FinalBuilder problem, but humour me a little …

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [September 27, 2006, 1:37am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/24 "2006-09-27T01:37:04Z")

</div>

Hi Ken,  
  
FinalBuilder does this using the DOM properties of MSXML rather than XPath, ie it iterates xmlDoc.documentElement.attributes[] looking for xmlns attributes. It’s not the cleanest solution, but it works.  
  
We’ve been meaning to try and find a better way around this (ie no need for an arbitrary prefix), but there doesn’t seem to be one.  
  
Regards,  
  
  
Angus

---

<div class="post-metadata">

### Author: ![ken\_turner](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/7993a0/32.png) [@ken\_turner](https://www.finalbuilder.com/forums/u/ken_turner)
#### Post date: [September 27, 2006, 8:27am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/25 "2006-09-27T08:27:57Z")

</div>

If you really have nothing better to do, you can see further discussion of (the non-FinalBuilder aspects of) this problem here:  
  
[http://www.experts-exchange.com/Web/Web\_Languages/XML/Q\_21996077.html](http://www.experts-exchange.com/Web/Web_Languages/XML/Q_21996077.html)

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [September 27, 2006, 9:31am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/26 "2006-09-27T09:31:01Z")

</div>

hmmm, those answers aren’t too inspiring… good luck with finding the answer! 🙂

---

<div class="post-metadata">

### Author: ![ken\_turner](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/7993a0/32.png) [@ken\_turner](https://www.finalbuilder.com/forums/u/ken_turner)
#### Post date: [September 27, 2006, 9:45am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/27 "2006-09-27T09:45:33Z")

</div>

Thanks, Tate.  
  
Any comments about the example above which worked with MSXML3 and failed with MSXML4?

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [September 27, 2006, 10:24am UTC](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191/28 "2006-09-27T10:24:32Z")

</div>

> I set up another Read XML Value to Variable action, using the same source file, with the value /Project in the Xpath box and xlmns in the Read an Attrribute box. This worked fine in MSXML3, but reports ‘XPath returned no node : /Project’ with MSXML4.

I had to do the same xmlns:a trick thingo to get it to work with both msxml3 and msxml4 - so don’t know why it’s different for you.  
  
.t8

[Previous page](https://www.finalbuilder.com/forums/t/xml-path-node-not-found-error/191.md?page=1)
