title: In XML, is multiple level !ENTITY usage possible?
body: <p>We are using XML to define a schema for controlling the contents which can be displayed in a diagramming tool. The schema file specifies what kinds of object can be placed on the diagram, how they can be linked together, and what properties these objects have (that is, what settable properties apper in the editor).</p>
  
  <p>When a new kind of diagram is needed, a new schema is written, and is validated against an .xsd.  In order to make the schema file more modular and easier to maintain, we are using <code>&lt;!ENTITY&gt;</code> declarations to include separate files. Lists of properties etc. which belong together on a particular diagram element, but which might appear in several places in the schema, are written in a separate XML file, and then included at the relevant place. Say:</p>
  
  <pre><code>&lt;!-- Nameing etc. just as an example --&gt;
  &lt;!ENTITY CommonProerties1 SYSTEM "file:../CommonProperties1.xml"&gt;
  &lt;!ENTITY CommonProerties2 SYSTEM "file:../CommonProperties2.xml"&gt;
  </code></pre>
  
  <p>and then somewhere in the schema:</p>
  
  <pre><code>&lt;Node shape="Square"&gt;
      &amp;CommonProperties1;
      &lt;!-- Specific properties go here --&gt;
  &lt;/Node&gt;
  </code></pre>
  
  <p>This prevents a lot of copy-pasted stuff that makes maintaining difficult, and lets common properties be shared with multiple schemas too.</p>
  
  <p>The trouble is that now, some of the common properties also have base elements, such as groups of flags and enums etc. I would like to make each file (such as "CommonProperties1.xml") be able to include from another base set such as "CommonEnums.xml", but I don't think this is possible using !ENTITY declaractions.</p>
  
  <p>You can't declare an !ENTITY outside of a !DOCTYPE header, and if you add the header then it makes the top level XML file invalid as it gets a header declaration 1.2 way through the file.</p>
  
  <p>Has anyone ever tried to do similar things, and what did you do to work round / solve the problem? Is there a better option I'm missing?</p>