Is it a bug or per design that xmlns attribute is not ignored?
(cake version 0.33.0)
With an Xml like so (a too simplified nuspec file):
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Continuously updated elements -->
<version>3.0.0</version>
</metadata>
</package>
I do a naÏve call
var x = XmlPeek( "my.nuspec", "/package/metadata/version/text()" );
ad get the result x==null
.
So I specify the namespace like so:
var settings = new XmlPeekSettings{
Namespaces = new Dictionary<string, string> {{
"ps", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
}}
};
var x = XmlPeek( "my.nuspec", "/ps:package/ps:metadata/ps:version/text()", settings);
and get the result x==3.0.0
I anticipated.