ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Mixed content problem with literal XML data via DynamicConfig urator
Date Fri, 31 Oct 2003 17:37:10 GMT
> From: Dominique Devienne []
> > From: Patrick Surry []
> >
> > Thanks to feedback from the list, I've got a slightly modified version
> of
> > Dominique's code working (see end) that builds a DOM document to house
> > whatever
> > 'literal' XML data I want within my task, including property
> substitution
> > for
> > attribute values and text nodes.  The only problem now is that it
> doesn't
> > seem
> > to work well for 'mixed' content (ie. mixed elements and text) since all
> > the
> > child elements seem to get create'd prior to any of the text-node
> > siblings.
> <snip/>
> >
> > Any thoughts?  I'm guessing it's because all createDynamicElement()
> calls
> > happen before any addText() calls - should I be able to createText() to
> > preserve the sequencing?
> See for a
> recent discussion of this issue. Your use case might be a legitimate
> reason for introducing 'proper' handling of 'Text' XML nodes. --DD

Thinking about it a bit more, I think you could use a similar turn around I
used for my <bm:echo> task. Here's the XML outline:

<xmlfragment replaceProperties="true" textNodeName="text">
  <something foo="bar${foo}">
  <text>And ${foo} more...</text>

'textNodeName' is there so you can dynamically assign a different Text Node
name to avoid conflicts with an XML fragment that contains the default
<text> element. And 'replaceProperties' is to make property substitution

Of course, fixing Ant core to properly deal with mixed content would be
better, but then again it's not the only place Ant code doesn't give you
full access to the XML infoset.
* What about the namespace of each element/attribute?
* What about processing instruction?
* What about comments in the XML fragment?

These would all have to be dealt with correctly to implement a proper
XmlFragment. Maybe an completely different alternative would be to use the
Location instance and Project.getBuildFile() to fully reparse the build
script using an XML parser, and get the full infoset!!!


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

View raw message