You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Jaffe <mj...@eturn.com> on 2001/05/21 23:43:46 UTC

Ant not recognizing entity

I am creating an HTML page in my build file, and writing a version string
into it. I got an error when I first executed this code:

  <target name="base" depends="init">
  <!-- Create version file HTML template -->
  <echo file="ps/html/version.tmpl" >
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Build Version&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"&gt;
&lt;/head&gt;

&lt;body topmargin="0" marginheight="0" bgcolor="#FFFFFF" text="#000000"&gt;
&lt;center&gt;
Build @version@
&lt;hr&gt;
&lt;font size=-2 face=arial&gt;Copyright &copy; 2001 Eturn Communications,
Inc. &lt;/font&gt;
&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
</echo>
  <!-- Insert version info into HTML template -->
  <replace file="ps/html/version.tmpl" token="@version@" value="${vers}
&lt;br&gt;built on ${DSTAMP} at ${TSTAMP}"/>
  <touch file="${vers}" />
  <move file="ps/html/version.tmpl" tofile="ps/html/version.html" />

At the line containing "&copy;" Ant complained about an unknown entity. Any
thoughts on this? This should carry over from HTML. It works if I use "(c)"
instead of &copy; but the page won't match everything else that has the
&copy; thing in it.

Mark


Re: Ant not recognizing entity

Posted by Stefan Bodewig <bo...@apache.org>.
Mark Jaffe <mj...@eturn.com> wrote:

> I am creating an HTML page in my build file, and writing a version
> string into it. I got an error when I first executed this code:

>   <echo file="ps/html/version.tmpl" >
> &lt;html&gt;
>...
>&copy;
>...
></echo>

copy is not a known entity for the XML-parser.  I think you'd better
use a CDATA-section:

<echo file="ps/html/version.tmpl" ><![CDATA[
<html>
...
&copy;
...
]]></echo>

or use a template like Diane suggested.

Stefan

Re: Ant not recognizing entity

Posted by Diane Holt <ho...@yahoo.com>.
I don't think including the "&copy;" is going to work the way you want it
to. You want it to go into your HTML file as the literal string, not be
replaced by the symbol. My advice would be to get rid of all the <echo>
stuff and just create and source-control your template file, with tokens
for your version and date/timestamp, then just <copy> with filtering to
version.html (as a side-note: since you were using <replace>, you don't
really need to write to one file, replace your tokens, then move it to the
file you want -- you could've just written to the file you wanted in the
first place).

Diane
 
--- Mark Jaffe <mj...@eturn.com> wrote:
> I am creating an HTML page in my build file, and writing a version
> string
> into it. I got an error when I first executed this code:
> 
>   <target name="base" depends="init">
>   <!-- Create version file HTML template -->
>   <echo file="ps/html/version.tmpl" >
> &lt;html&gt;
> &lt;head&gt;
> &lt;title&gt;Build Version&lt;/title&gt;
> &lt;meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1"&gt;
> &lt;/head&gt;
> 
> &lt;body topmargin="0" marginheight="0" bgcolor="#FFFFFF"
> text="#000000"&gt;
> &lt;center&gt;
> Build @version@
> &lt;hr&gt;
> &lt;font size=-2 face=arial&gt;Copyright &copy; 2001 Eturn
> Communications,
> Inc. &lt;/font&gt;
> &lt;/center&gt;
> &lt;/body&gt;
> &lt;/html&gt;
> </echo>
>   <!-- Insert version info into HTML template -->
>   <replace file="ps/html/version.tmpl" token="@version@" value="${vers}
> &lt;br&gt;built on ${DSTAMP} at ${TSTAMP}"/>
>   <touch file="${vers}" />
>   <move file="ps/html/version.tmpl" tofile="ps/html/version.html" />
> 
> At the line containing "&copy;" Ant complained about an unknown entity.
> Any
> thoughts on this? This should carry over from HTML. It works if I use
> "(c)"
> instead of &copy; but the page won't match everything else that has the
> &copy; thing in it.
> 
> Mark
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/