title: How to find out XSD file dependencies
body: <p>I would like to store all XSD files which are needed to parse a particular XSD file.
  <a href="https://stackoverflow.com/questions/40403580/hosting-w3-xml-schema-files-locally">This answer</a> says that we should look for <code>xs:include</code> and <code>xs:import</code> attributes.</p>
  
  <p>But what about namespaces used inside elements? Often root elements (schema declarations) have multiple namespace declarations.
  If we encounter those in XSD files, shouldn't we include the XSDs for these namespaces as well?</p>
  
  <p>For example, in this XSD file, shouldn't we need to include XSDs that define <code>urn:oma:xml:xdm:extensions</code> and <code>urn:ietf:params:xml:ns:resource-lists</code> and <code>http://www.w3.org/2001/XMLSchema</code> namespaces?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema
      targetNamespace="urn:3gpp:ns:mcpttGroupInfo:1.0"
      xmlns:mcpttgi="urn:3gpp:ns:mcpttGroupInfo:1.0"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:oxe="urn:oma:xml:xdm:extensions"
      xmlns:rl="urn:ietf:params:xml:ns:resource-lists"
      elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
  
      &lt;xs:import namespace="urn:oma:xml:xdm:extensions"/&gt;
      &lt;xs:import namespace="urn:ietf:params:xml:ns:resource-lists"/&gt;
  
      &lt;!-- XSD element and type definitions --&gt;
  
  &lt;/xs:schema&gt;
  </code></pre>