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
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
cheers,
.t8
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’“
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 …
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
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
hmmm, those answers aren’t too inspiring… good luck with finding the answer!
Thanks, Tate.
Any comments about the example above which worked with MSXML3 and failed with MSXML4?
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