title: XML Schema: replacing imports with corresponding schema
body: <p>I have a XML Schema that contains multiple imports which in turn contain imports. I need to generate semantically equal schema where all imports are inlined. I want to replace these: </p>
  
  <pre><code>&lt;xs:import namespace="http://some.name/" schemaLocation="./path/to/it.xsd"/&gt;
  </code></pre>
  
  <p>with the contents of referenced schemata. And I need to get output as a string, not as some internal representation.</p>
  
  <p>I tried <a href="http://xerces.apache.org/" rel="noreferrer">Apache Xerces</a> but did not find a way to write XSModel to a string. Is there?</p>
  
  <p>I tried <a href="http://ws.apache.org/commons/xmlschema20/" rel="noreferrer">Apache XmlSchema 2</a> but when it writes XML Schema it does not replace import declarations with schema.</p>
  
  <p>Is there any library that can do it? Any suggestions?</p>
  
  <p>Thanks.</p>