ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject xinclude for ant?
Date Wed, 20 Jun 2007 21:43:13 GMT
I have just realized that xinclude can be enabled
easily using JAXPUtils:

Index: src/main/org/apache/tools/ant/util/JAXPUtils.java
===================================================================
--- src/main/org/apache/tools/ant/util/JAXPUtils.java   (revision 545653)
+++ src/main/org/apache/tools/ant/util/JAXPUtils.java   (working copy)
@@ -103,6 +103,7 @@
         if (nsParserFactory == null) {
             nsParserFactory = newParserFactory();
             nsParserFactory.setNamespaceAware(true);
+            nsParserFactory.setXIncludeAware(true);
         }
         return nsParserFactory;


This allows one to do:
<project default="x"  xmlns:xi="http://www.w3.org/2001/XInclude">
  <target name="x">
    <echo>Hello</echo>
    <xi:include href="a.xml"/>
  </target>
</project>

where a.xml is:
<sequential>
  <echo>world</echo>
</sequential>

I can see problems :- the inclusion is at the xml level and ant does
not know about the included file (ant does not get SAX events on about
the inclusion), so that any
errors in the included file will be reported at the includer line.
This means that it is not user friendly.

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


Mime
View raw message