RFC: xinclude in XML config

Dan Tihelka <[email protected]> Fri, 28 Dec 2012 23:23:04 +0100
Newsgroups gmane.comp.java.cruise-control.devel
Message-ID <33920253.fC9SGjVv5b@uk508n02-kky>
Hi all,
I have experimented with the use of xinclude in CC's project config. We used it 
to load some project-specific configuration, which is impossible to achieve with 
<include.projects /> element.

The change required to this is really trivial - see the proposed patch. 
However, there may be a "problematic" part of the patch in 
PluginXMLHelper.java - I have to change an exception to warning, since the 
included XML elements contain the ID attributes as well, which were detected 
as "unsupported" by CC.

So, I would like to ask if you are not in an objection against the change. If 
not, I will commit it in the new weekend (5/6.1.) ...

Thank you co your comments. Regards,
Dan T.

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812

_______________________________________________
Cruisecontrol-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-devel
xinclude.patch (text/x-patch, 1.6 KB)
Index: main/src/net/sourceforge/cruisecontrol/PluginXMLHelper.java
===================================================================
--- main/src/net/sourceforge/cruisecontrol/PluginXMLHelper.java	(revision 4620)
+++ main/src/net/sourceforge/cruisecontrol/PluginXMLHelper.java	(working copy)
@@ -256,8 +256,10 @@
                 LOG.fatal("Error configuring plugin.", e);
             }
         } else {
-            throw new CruiseControlException("Attribute: '" + propName
-                    + "' is not supported for class: '" + object.getClass().getName() + "'.");
+            LOG.warn("Ignoring attribute: '" + propName
+                  + "' for class: '" + object.getClass().getName() + "'.");
+//            throw new CruiseControlException("Attribute: '" + propName
+//                    + "' is not supported for class: '" + object.getClass().getName() + "'.");
         }
     }
 
Index: main/src/net/sourceforge/cruisecontrol/util/Util.java
===================================================================
--- main/src/net/sourceforge/cruisecontrol/util/Util.java	(revision 4620)
+++ main/src/net/sourceforge/cruisecontrol/util/Util.java	(working copy)
@@ -62,6 +62,7 @@
     public static Element loadRootElement(File configFile) throws CruiseControlException {
         try {
             SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
+            builder.setFeature("http://apache.org/xml/features/xinclude", true);
             return builder.build(configFile).getRootElement();
         } catch (Exception e) {
             throw new CruiseControlException(
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEABECAAYFAlDeG9EACgkQuYlVhxo/P1FtKACfX/ZZjPQ6T6emUDvf+BvLldH1
UcEAn0NdTWquLK0+voFZDJOyQwYTDCQ6
=ZIBx
-----END PGP SIGNATURE-----