As part of the CI process, I am trying to create a buildlabel that consists of the contents of an xml element in an xml structure. For this, I use nant and xmlpeek. My problem is that I get a weird error:
"Nodeindex" 0 "out of range"
This is only if the xml file that I am xmlpeeking contains a namespace definition in the root of the node.
Removing the namespace from the XML file gives me the result that I expect.
The redirected target that generates the error can be reduced to:
<target name="TDSLabel"> <property name="element" value=""/> <echo message="Getting element" /> <xmlpeek file="C:\xxx\test1.xml" xpath="//Project/PropertyGroup/ProductVersion" property="element"/> <echo message="The found element value was: ${element}" /> </target>
and test1.xml looks like this:
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProductVersion>9.0.21022</ProductVersion> </PropertyGroup> </Project>
source share