From RootdevWiki
XML Reference
Various bits and pieces for working with XML files.
How do I include an external file or snippet in an XML Document?
I recall finding the documentation for this needlessly complex, so hopefully in simple terms here's how you do it:
You need to declare the external file as an Entity in the DTD, then call it by reference in the appropriate place.
<!DOCTYPE example1 [ <!ENTITY snippet1 SYSTEM "/path/to/snippet1"> ]> <foo>...</foo> <example1> <bar>...</bar> &snippet1; <!-- reference to external entity here--> <etc>...</etc> </example1>
Where this tripped me up was in getting my head around the fact that the DTD refers to the XML element in which the external file is to be included. I'm sure this is documented somewhere, or assumed to be so obvious as to not need stating, but it took me a while to figure out so I hope this might save you a headache or two.

