Hi all,

Does anyone has means of dividing Struts config files into separate files,
so that one main file can include all separate files?

I've been working on quite big applications where some code is automatically
generated. Sometimes Struts config files (struts-config.xml, validator.xml
and tiles-defs.xml for example) grow fast and developpers must add their own
stuff in middle of automatically generated stuff, which becomes messy.

I thought about Struts module but actually it doesn't really suit my needs.
So I tried to divide the files into separate files thanks to XML entities.
So I can have one main struts-config.xml where developpers can work on and
this file can include other files (to define action mappings or forms). Here
is what I did:

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"; [
          <!ENTITY generated-forms SYSTEM "generated-forms.xml">
]>

...

<form-beans> 
        <!-- my generated forms -->
        &generated-forms;

        <!-- developpers' forms -->
...


It works quite well and really clean the mess. I tried the same thing with
tiles-defs.xml but it seems the XML parsing is different: it was trying to
get the included file in my IDE (Eclipse) directory and actually does the
same thing if I change the DTD to SYSTEM. So it's useless as it can look in
the project WEB-INF directory. With validation.xml, it doesn't have any DTD,
so my trick can't work. I also tried XInclude with something like:

<xi:include href="myFile.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

but it doesn't include anything.

Does anyone tried to divide their config files like this and managed to do
it? Or has a XML guru any mean to include XML into another?

Thanks,
Arno

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to