Yep, I bet that would work if you have your config files split up by
"top-level" (children of the root) elements, the way you have described it
(1 file each for formbeans, globalforwards, actionmappings, etc.).  What we
have, however, are separate files which EACH contain a <globalforwards>
element, an <actionmappings> element, and a <formbeans> element.

We do this so that all of the configuration data for Actions which form
logical groupings in our system are contained within the same config file.
So we have a config file for each logical grouping (at least, we hope
they're logical :))  Our build process then merges the contents of these
top-level elements from each file into the struts-config.xml file.

I'm not sure if there are any tools for doing this sort of thing...I haven't
been able to find any, that's for sure, which is why we use a native script
to do it at present (which I wish to replace with a custom Ant task).


cheers,

Joe Barefoot


-----Original Message-----
From: John Kroubalkian [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 6:25 PM
To: [EMAIL PROTECTED]
Subject: Re: Struts config, can it have includes?


Have you tried using XML ENTITY tags to declare an external entity?

Something like the following at the top of your struts-config.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
    http://jakarta.apache.org/struts/dtds/struts/dtds/struts-config_1_0.dtd
    [
    <!ENTITY mydatasources SYSTEM http://mysite.com/myxmls/datasources.xml >
    <!ENTITY myformbeans SYSTEM http://mysite.com/myxmls/formbeans.xml >
    <!ENTITY myglobalforwards SYSTEM
http://mysite.com/myxmls/globalforwards.xml >
    <!ENTITY ... SYSTEM http://mysite.com/myxmls/....xml >
]>

  <struts-config>
    &mydatasources;
    &myformbeans;
    &myglobalforwards;
    &...;
  </struts-config>

Here the &mydatasources; is the alias in the struts-config.xml for the file
located at the specified URI.

NOTE:  I'd like to know if anyone else is doing something similar to this.

Regards,
John

----- Original Message -----
From: "Joseph Barefoot" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, March 19, 2002 11:06 AM
Subject: RE: Struts config, can it have includes?


> Interestingly enough, we do the exact same thing in our project (many .xml
> files), and currently we use a perl script to merge the XML files (boo!).
> However, I've been writing an Ant task that merges XML files into a single
> file to replace the perl...but it's not finished (doh!).  Most of the code
> is written, however--I just haven't had time to work out the kinks yet.
> It's configurable to flat include the top-level (children of the root)
> elements from each source file in the output file, or to merge the
contents
> of top-level elements with the same name into single Elements (w/ the same
> name) in the output file.  You can set the DocType and such as well via
task
> attributes.
>
> I'll probably have this tested and complete in a week or so, if you're
> interested.  I plan to add more options as I think of them.
>
> I'm not sure about the use of XML include references, but good luck if you
> go that route. :)
>
> regards,
>
> Joe Barefoot
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 9:08 AM
> To: Struts Users Mailing List
> Subject: Struts config, can it have includes?
>
>
>
> Is it possible to have a struts-config.xml file that simply does nothing
> more than include other xml-files which contain all the form-bean and
> action tags?   Or does everything have to be slam-dunked into the main
> struts-config.xml.    Reason I ask is that we have 3 developers here
> developing a struts application.   Each one of us needs to create about
> 40-60 actions or so.    It would be easier to have many different .xml
> files that each of us can own that are simply included into the main
> struts-config.xml file.   We're early into the development project and
> someone will always have that file checked out.
>
> thanks,
> Theron
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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

Reply via email to