XML Node not found (msbuild file)

I’m attempting to access version information from a .dproj (msbuild) xml document. I’m able to do it in Notepad++ and in my own Delphi (MSXML) code. In Finalbuilder it reports “Node not found”.
I have escaped the “$(” as “$$(” in FinalBuilder.
I’ve got a simple 3 line project if you’d like to take a look.

Here is my XPath:
/Project/PropertyGroup[@Condition = "'$(Base)'!=''"]/VerInfo_MajorVer

Here is the source XML (stripped down for easy reading):
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition="$(Base)'!=''"> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_MajorVer>4</VerInfo_MajorVer> <VerInfo_MinorVer>1</VerInfo_MinorVer> <VerInfo_Release>1</VerInfo_Release> <VerInfo_Build>1</VerInfo_Build> <VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion> <VerInfo_Locale>1033</VerInfo_Locale> </PropertyGroup> </Project>

Hi Pete

I suspect this has to do with xml namespaces.

See this blog post

https://www.finalbuilder.com/resources/blogs/xml-actions-and-the-xpath-returned-no-node-error2

This is just how MSXML works. The Project node has a namespace, so you need to prefix it

/x:Project/x:PropertyGroup[@Condition = "'$(Base)'!=''"]/x:VerInfo_MajorVer

Hi Vincent - Thanks for the fast response. It’s nice dealing with folks in AU and NZ because I post in the evening and I always have a response in the morning :slight_smile: Today was even faster.

So - you are correct that I needed a namespace prefix. I’d tried a few possibilities, but none had worked. Based on the article you sent, I tried again. Still no joy. However, I think I have identified, if not fixed, the problem. I changed the XML node that I was looking for from:
<PropertyGroup Condition="$(Base)'!=''">
to
<PropertyGroup Condition="Simple">
And it worked.
So, I think it may have to do with quote nesting and/or escaping. That was a challenge I dealt with in my Delphi app too.
Any chance you could give this a try? I’ve updated the test project to have a working and a failing section. (still just a few lines long) I can email it if you’d like.
If there isn’t an existing solution, I’ll try to figure out how to create my own actions in this new version. It’s been a while.
Thanks!XPathTest.fbx8 (8.2 KB)

There’s a mistake in the document,

 <PropertyGroup Condition="$$(Base)'!=''">

should be

 <PropertyGroup Condition="'$$(Base)'!=''">

When I tested this with a dproj file on my system (one of FinalBuilder’s) it worked first time

Working project attached (I literally just add a single ’ and it worked.

XPathTest.fbx8 (8.2 KB)