Sure, as soon as I have some time, probably this week. :)


From: John Ludlow [mailto:[EMAIL PROTECTED]
Sent: segunda-feira, 13 de Fevereiro de 2006 19:46
To: João Hugo Miranda (DNC)
Cc: nant-developers@lists.sourceforge.net
Subject: Re: [nant-dev] New XML tasks and functions

Ok, I've made a few improvements to my copy.  Joao, would you mind trying this version and letting me know how you get on, please?  Thanks in advance.  ;)

Some things to note with it, though:  This is an updated NAnt.Core.dll , so delete the XmlExtensions one if that's what you're using.  Also if you're using that version, the XmlPoke2 task is now part of XmlPoke.  From that it gets the benefit of namespaces and all kinds of funkiness like that, and also will (hopefully) be merged into the trunk copy of NAnt.

Summary of the changes, then. 
  • There's now an XmlTaskContainer for the for-each task, which in turn inherits from TaskContainer.  Other than that, it's just the same as XmlTask.  (Again, because of this, this task should be able to understand namespaces).
  • All-round better error handling.  xml::get-value() and xml::get-value-without-failing() don't return an error if the XPath points to a node, rather than a value.  I think get-value should, but I'm still thinking about how it could make that decision.  If you want to ensure it fails under this situation, and the value you want isn't an attribute, you can put '/text()' in the xpath, like so:
    • <echo message="${xml::get-value(/root/test/text())}"/>
  • Better error messages.
There are still some issues.  The way the functions seem to be reading the XML data is causing some strange formatting issues, which could be annoying if you want to read data in then write it out again, then edit or read the resulting file manually.  And the functions don't support namespaces.  I'm considering making changes to the _expression_ evaluator so that it can support a namespace manager, and I was looking into the code for the evaluator today.

Regards

John

On 13/02/06, John Ludlow <[EMAIL PROTECTED]> wrote:
Hi Joao,

Thanks for your feedback, and I'm glad you found it useful.  I'll look into the issues with the error messages (I think that in the code it should have general catch handlers that throw a BuildException, since anything else results in a not-very-clear messag).

Were the messages you got saying INTERNAL ERROR?

John


On 13/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi,
 
Just to give you notice of my experience with you xml tasks and functions.
 
Overall, all went smoothly and most important, it solved my needs perfectly. There were only minor quirks with error conditions, or should I say error messages as they were not very clear. For example:
  • If the Xml-ForEach task doesn't find the source Xml it blows without giving a very informative message.
  • If the XPath query given to get-value-without-failing (and I assume the get-value) function resturns a node and not a value, the function again fails without a clear message.
Thanks again for your effort! It was (is) most useful.
 
João


From: John Ludlow [mailto:[EMAIL PROTECTED]]
Sent: sábado, 28 de Janeiro de 2006 16:43
To: João Hugo Miranda (DNC)
Subject: Re: [nant-dev] New XML tasks and functions



On 28/01/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:
Well, what can I say but thank you? I never cease to be amazed by how some people can be so incredibly helpful. I'll give it a try as soon as I can and keep you posted.

Well, that's the nature of a community project like this.  My life has been made so much easier by, shall we say "the kindness of strangers", and it's nice to give something back.  It also means that future updates might be easier for me if this becomes widely adopted and integrated into the NAnt release at some point.

Thanks again!
João (Curious... João means John in portuguese :) )

Aha!  I wondered if it meant something like that.  I know Juan is Spanish for John.  Nice to meet a fellow John out there!  ;)


From: John Ludlow [mailto:[EMAIL PROTECTED]]
Sent: sábado, 28 de Janeiro de 2006 16:19
To: João Hugo Miranda (DNC)
Subject: Fwd: [nant-dev] New XML tasks and functions

Hi,

Just remembered I'd sent it to someone else, so I'll just forward you the same email (probably easier than you waiting for me to get into work on Monday).

Attached to this email should be a zip with the source code and binaries in.  Copy the assembly into the NAnt\bin folder.  Alternatively, I have also attached a build file which you can <include> into your build (though I've noticed that the <xml-foreach> task in that one is a little behind the assembly version, in that it doesn't support the index attribute).  I've submitted a patch to Ian MacLean that provides these functions and an updated <xmlpoke> task, so you might see these features in a future version of NAnt.

One thing I think the other guy found confusing (so I might change it) is that by default the <get> elements don't return an error if they couldn't find the node.  I figured you could do a property::exists() call.  It's a trivial change, though, and in the meantime you can always set the failonerror attribute for <get> to true.

Anyway, let me know how it goes.  Glad I could help ;)

John




Reply via email to