cakebuild - Retrieving an XML value in Cake build? -
is there simple way of retrieving xml value file using cake build automation system?
i've been poking around cake.common.xml namespace, seems geared toward modifying (xmlpoke
) or transforming (xmltransformation
) xml. docs on methods make them appear geared toward prepping xml use in later build steps consume, don't return anything.
ideally, go in filepath
object xpath query string , resulting value.
specifically, i'm trying extract values xamarin.android project's androidmanifest.xml use in naming resulting apk cake.xamarin call, seems functionality should @ cake.common.xml level.
as of cake v0.8.0, there xmlpeek
cake.common.xml.xmlpeekaliases
namespace. pass filepath
instance , xpath query (with optional settings things namespaces), , return string.
for example, given local xml file this…
<some> <nested> <thing someattribute="attributevalue" /> <otherthing>some text value</otherthing> </nested> </some>
for example, attribute's value…
var attributevalue = xmlpeek(file("example.xml"), "/some/nested/thing/@someattribute")
…will string of attributevalue
.
and text nodes value…
var textnodevalue = xmlpeek(file("example.xml"), "/some/nested/otherthing/text()");
…will string of some text value
.
Comments
Post a Comment