Bugs item #1381029, was opened at 2005-12-14 19:41
Message generated for change (Comment added) made by garyfx
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1381029&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: sand0z (sand0z)
Assigned to: Nobody/Anonymous (nobody)
Summary: Expression evaluation less than or equals requires <

Initial Comment:
I'm using nant build 0.85.2143.0; nightly 11/13/2005. 

I want to see if one integer is less than or equal to
another. That is, compare to integers using <=

1. So I write my test: 
<if test="${5 <= 0}" >
<echo message="Val 1 not-less-or-equal-to 0 or less."
/> </if>

I shouldn't get a: 
"Error loading buildfile. 
  '<', hexadecimal value 0x3c, is an invalid attribute
character, Line 159, position 20."

(I've attached the stack trace)

2. If I go: >=, as in: 
<if test="${5 >= 0}" >
<echo message="Val 1 not-less-or-equal-to 0 or less."
/> </if>

Things work fine. 

3. If I go: &lt;=
 
<if test="${5 &lt;= 0}" >
<echo message="Val 1 not-less-or-equal-to 0 or less."
/> </if>

Things work fine.

4. If I go: ==
<if test="${5 == 0}" >
<echo message="Val 1 not-less-or-equal-to 0 or less."
/> </if>

Things work fine.

Thanks for looking into this! If a bug has already been
submitted for this, please forgive, I did do some
searching to see if this bug existed, but if something
was there, I couldn't find it. 


----------------------------------------------------------------------

Comment By: Gary Feldman (garyfx)
Date: 2005-12-15 19:20

Message:
Logged In: YES 
user_id=847172

I think that "by design" was a poor choice of words.  It's
part of the design of XML, not NAnt.  When NAnt, following
in the footsteps of Ant (and everyone else), chose to use
XML as the basis for its input, it inherited all of the
limitations that XML imposes.

XML simply will not allow the less-than symbol to appear
inside an attribute string.  You can try it yourself -
create a file containing just "<tag attr="abc<def" />",
being sure to name it as a .xml file, and try opening it
directly in your browser.  Change the < to > and try again.  

NAnt uses the .Net XML parser, and that's the way life is. 
 In theory, one could write a non-compliant parser that
would handle these, but it wouldn't be worth the effort for
this one particular case.

----------------------------------------------------------------------

Comment By: sand0z (sand0z)
Date: 2005-12-15 11:13

Message:
Logged In: YES 
user_id=1338161

I'm not sure what you mean, "by design". I'm not sure why <=
doesn't work but ==, and >= works. If you can get == and >=
working, then <= should work also. It seems like a bug, not
an inherent flaw. Perhaps I completely misunderstand what
you have said. Could you clarify what you mean?

&lt; for that mater &gt; (ie, less than, greater than) I'm
not sure where it comes from either. I know it is something
that you can use in html to get < and >  to render ok on web
pages. I used it because I used the &quot; and &gt; before
to work around another problem where I needed quotes within
quotes and a > (redirect, also a "greater than")... (so I
tried &lt; and it worked)

see? 
<echo append="True" file="encryptor.bat"
message="${g_HexBin}\Encryptor.exe &quot;${g_KeyFile}&quot;
&quot;${g_FileToEncryptPath}\&quot;
${g_EncryptFlags} &gt; ${tEncryptionOutFile}" />

created a encryptor.bat file with a single line that looked
like: 
c:\somedir with a space\Encryptor.exe "ceasar.txt"
"c:\somedir with a space\somefile.txt" -e > outfile.txt



----------------------------------------------------------------------

Comment By: Martin Aliger (maliger)
Date: 2005-12-15 01:53

Message:
Logged In: YES 
user_id=655297

This is "by design". In fact everything built atop of XML 
have this flaw. XSLT comes to my mind, but there are alot 
of technologies around.

Maybe we should stress this fact in documentation. I was 
unable to find any mention of &lt; at all. (expression 
page?)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1381029&group_id=31650


-------------------------------------------------------
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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to