On 10/11/05, David G. Friedman <[EMAIL PROTECTED]> wrote:
>  Paul,
>
> > See, after all these years, I really wanted was to
> > split files up. Modules don't gain me anything, do
> > they? I know (or I think) when Craig wrote Struts 0.x,
> > he had an action.xml which did something similar....
> > Now I could create file of just actions and use XML
> > ENTITIES to include them, but I never see people doing
> > that solution. Is it not well-known or frown upon?
>
> I'd only heard once on this list about the XML entities trick.  Personally,
> I'd prefer that one like that if I were creating anything large enough to
> warrant breaking the configuration down into multiple files/modules. :)

Entities are a standard XML thing. Here is another trick, though it is
a bit offtopic. Say, you want to output data to XML. And you have a
regular structure of XML elements, like this:

<body>
  <element>some stuff</element>
  <element>some more stuff</element>
  <element>event some more stuff</element>
<body>

You can do that in an XML file, but you cannot simply append to the
file, because you always need to close <body> to keep XML well-formed.
So, here is what you do:

header.xml:
-------

<?xml version="1.0"?>
<!DOCTYPE MYDOCUMENT [
<!ENTITY content SYSTEM "content.xml">
<!ELEMENT BODY (RECORD*)>
]>
<BODY>&content;</BODY>

content.xml:
------
<RECORD>Some stuff</RECORD>
<RECORD>Some more stuff</RECORD>
<RECORD>And some more stuff</RECORD>

Voila. Now you can append <RECORD> elements to the content.xml file,
and resulting document will stay well-formed.

Michael.

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

Reply via email to