ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject Re: echoxml task append attribute useless?
Date Mon, 01 Jun 2009 14:20:07 GMT
On Mon, Jun 1, 2009 at 1:49 AM, Shawn Castrianni
<> wrote:
> The echoxml task has an append attribute which seems useless to me.  Since the children
xml tags of the <echoxml> tag itself is used for echoing AND those children xml tags
are part of the ANT build file too, they must be valid xml content.  Therefore, every start
tag must have a closing tag, including the root node.  If you have to close the root node,
then there is no way to append anything else.  It is too late.  Maybe I am supposed to enclose
the children tags with CDATA??
> Nope, I just tried that and got a ClassCastException:
> java.lang.ClassCastException: org.apache.xerces.dom.TextImpl cannot be cast to org.w3c.dom.Element
> I think that in order for this append attribute to work, this task must allow both XML
elements AND XML text as children.  I see no other way.
> Am I missing something?

<echoxml> came from <echo> which has an append, and indeed does only
pure textual append. You can thus generate a invalid XML document with
several roots, which can be useful in some circumstances I guess.
Doing a true XML append is possible, but would require rewriting the
file, and that's not done.

If <echoxml> supported not putting out the <?xml> prolog, you could
emulate a "true" XML append by using a wrapper document using a bunch
of system entity "includes" you'd maintain yourself, since then all
the roots from the various <echoxml> "calls" would no longer be roots,
but that's left as an exercise to the reader ;)

And as usual, patches welcomed. --DD

PS: As the doc for <echoxml> shows, you can have TEXT nodes in the
XML. It works with a leaf TEXT node at least.

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

View raw message