ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject XMLFragment
Date Thu, 27 Nov 2003 12:15:02 GMT
Hi,

I've just added a utility class to CVS HEAD that can be used to turn
nested content into a DOMFragment (not necessarily a tree).  I.e., if
you use it as your nested element like

    public void addContext(XMLFragment f)

you can get the DOMFragment corresponding to the structure nested into
<content> from

   <content>
     <some-element>with nested text</some-element>
     <and-another-one with="parameters"/>
   </content>

via f.getFragment()

Dominique has posted similar code here and on the user list a couple
of times and Upayavira needed something like this for his cocoon Ant
task.  I will need it for my <nant> and <msbuild> sandbox tasks.

Some notes:

* it doesn't deal very well with mixed content - but this is a general
  problem of all Ant elements.

* Namespace support is not complete.  Peter, correct me if I'm wrong.
  I can get the namespace URI and the local name, but I can't get
  access to the prefix actually used on the elements when I use the
  DynamicConfigurator interface.

  Right now I don't parse the name at all, it may be better to extract
  the namespace URI and the local name (currently commented out in the
  committed code) instead.

* I've put it into the util package.  types would be an alternative.

* Even though I'll have to copy it into my dotnet antlib sandbox if I
  want to use it and Ant 1.6 together, I'd still prefer to keep it
  outside of the 1.6 branch in order to not push too many things into
  1.6 anymore.

Stefan

-- 
http://stefanbodewig.blogger.de/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message