ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: cvs commit: ant/docs/manual/CoreTasks echoxml.html
Date Wed, 25 May 2005 18:59:01 GMT
Matt Benson wrote:
> [...] AFAIK a
> non-well-formed fragment should forego the
> declaration.

I believe you can actually put an XML declaration in a doc with multiple 
top-level fragments, if you are using it as a parsed external entity. 
(Only useful to declare the encoding.) But I guess that few people would 
ever do this.

> If so, we can do one of the following:
> 1) Disallow > 1 direct child of <echoxml>
> 2) Always write fragments, skipping the declaration.
> 3) Automatically include the declaration when there
>    is only one direct child element.


> 4) Add some sort of cumbersome configuration options.
> XML not being my forte, I can say that 2) is simplest.

(1) or (2) is simplest, but for (4) it might be convenient to just be 
able to say

<echoxml includedeclaration="true">

and omit support for writing a DOCTYPE etc. On the other hand, writing a 
declaration manually with <echo> and CDATA is not hard.

There may be other subtleties for namespaces - e.g. if writing a single 
element, you can automatically generate namespace aliases, otherwise you 
may need aliases on each fragment. And careful about character encoding.


Possibly dumb semi-related idea: have the body of the task actually be 
an inline XSLT script with dummy input and the option to use the 
minimized form ("Literal Result Element as Stylesheet" in spec). Then 
you could use e.g.

     <root xmlns:xsl=""
         <xsl:if test="${} = 'true'">

In this case there is no need to worry about writing out XML precisely 
(JAXP handles it), and you can write out well-formed XML decls etc. 
using the full

     <xsl:stylesheet ...>
         <xsl:output method="xml" .../>

though I guess you cannot write out parallel fragments this way.

But I think I am inviting a flame war for suggesting it. :-)


--   x22801
if I had known it was harmless I would have killed it myself

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message