To use XPath against a document that uses namespaces, the implementation has to supply mappings via an XmlNamespaceManager, set into the XPathExpression after the XPathExpression has been compiled. This isn't always the most intuitive thing, and I'm completely unsure if NAnt supports it. Without it, you really cannot do XPath against namespace-aware documents, at least not that I know of. It would be a great thing to add if it isn't already in there.
--b ________________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hardesty, Matt Sent: Thursday, March 18, 2004 2:24 PM To: '[EMAIL PROTECTED]' Subject: [Nant-users] xpath bug in xmlpoke? I have an XML file called TickerHoldingsForm.xml with the following XML: <Form xmlns="urn:QueryForm.xsd"> <Title>Ticker Holdings</Title> </Form> In my build file I'm trying to replace the current Title with "Ticker Holdings Report" Here it is: <project name="test" default="deploy"> <target name="deploy"> <xmlpoke file="TickerHoldingsForm.xml" xpath="/Form/Title" value="Ticker Holdings Report"/> </target> </project> But I get the following error: [xmlpoke] Attempting to load XML document in file 'F:\Pending\3-18-04\TickerHoldingsForm.xml'. [xmlpoke] XML document in file 'F:\Pending\3-18-04\TickerHoldingsForm.xml' loaded successfully. [xmlpoke] Selecting nodes with XPath expression '/Form/Title'. [xmlpoke] No matching nodes were found with XPath expression '/Form/Title'. But when I take out the Form attribute it works fine. Is this a bug with the xmlpoke? Also, it only messes up with xmlns attributes, it works with others...hmm.... Thanks, Matt H. ________________________________________ Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users