Extracts text from an XML file at the location specified by an XPath expression.
For a list of all members of this type, see XmlPeekTask Members.
System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.XmlPeekTask
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
If the XPath expression specifies multiple nodes the node index is used to determine which of the nodes' text is returned.
The example provided assumes that the following XML file (App.config) exists in the current build directory.
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns="http://www.gordic.cz/shared/project-config/v_1.0.0.0"> <appSettings> <add key="server" value="testhost.somecompany.com" /> </appSettings> </configuration>
The example will read the server value from the above configuration file.
<xmlpeek file="App.config" xpath="/x:configuration/x:appSettings/x:add[@key = 'server']/@value" property="configuration.server"> <namespaces> <namespace prefix="x" uri="http://www.gordic.cz/shared/project-config/v_1.0.0.0" /> </namespaces> </xmlpeek>
Namespace: NAnt.Core.Tasks
Assembly: NAnt.Core (in NAnt.Core.dll)
XmlPeekTask Members | NAnt.Core.Tasks Namespace