RE: [nant-dev] XmlPeekTask extention
Hello, you got it. It is only difference. Reasoning: There are scenarios where you have to test, whether some element/attribute is present in the xml. Its _not_ an error, if such element/attribute is missing. Since xmlpeek task report it via exception, and even with failonerror set it is considered error, blaming nant users with false errors. I'm open to any changes/expansions to this. Maybe defaultValue=whatever is better? (and use this value if no match found?) Martin Aliger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian MacLean Sent: Tuesday, January 24, 2006 1:25 PM To: Martin Aliger Cc: ! nant Subject: Re: [nant-dev] XmlPeekTask extention Hi Martin, Sorry for the slow response to this Martin Aliger wrote: This introduce new boolean flag, which disable error message when XmlPeek task coudn'd find any maching node. This is very useful in some scenarios. I think, it could be useful to community, se here it is. Thanks for the patch but I'm curious - how is it different to just using the failonerror attribute ? The only difference I can see is that if the new attribute is used there will be no error and nothing logged whereas with failonerror=true it also won't fail but the error string will get logged if log level is set to verbose. Am I missing something here ? Ian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486; dat=121642 ___ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] XmlPeekTask extention
Martin Aliger wrote: Reasoning: There are scenarios where you have to test, whether some element/attribute is present in the xml. Its _not_ an error, if such element/attribute is missing. Since xmlpeek task report it via exception, and even with failonerror set it is considered error, blaming nant users with false errors. I'm open to any changes/expansions to this. Maybe defaultValue=whatever is better? (and use this value if no match found?) As long as you're brainstorming options, another approach could be to simply undefine the variable. (I'm not sure if that's even possible in NAnt.) In 90% of the cases, the user can first set the property to some well-defined null value, run the task, and check the result. For example, if you know the value you're fetching is supposed to be a number, you could use the string missing as the default value, and use a simple comparison to see whether or not the peek succeeded. The only time this wouldn't work is if there are absolutely no constraints on the possible data values, so that there's no way to pick a null value. Since the defaultValue attribute has the same problem, I don't see any advantage to it over simply setting the property to the default value in advance, and my preference is avoid introducing attributes when there's an easy alternative. Finally, I'd really like to see the default behavior changed to not cause a failure. The current behavior seems to violate the principle of least surprise, at least to me. Besides, you can usually do a better job with the error message, by simply detecting the failure and using your own fail with wording more appropriate to the situation. Gary --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] XmlPeekTask extention
Hi Martin, Sorry for the slow response to this Martin Aliger wrote: This introduce new boolean flag, which disable error message when XmlPeek task coudn'd find any maching node. This is very useful in some scenarios. I think, it could be useful to community, se here it is. Thanks for the patch but I'm curious - how is it different to just using the failonerror attribute ? The only difference I can see is that if the new attribute is used there will be no error and nothing logged whereas with failonerror=true it also won't fail but the error string will get logged if log level is set to verbose. Am I missing something here ? Ian --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers