title: Denormalize an XML schema programmatically
body: <p>I need to take any given valid XML schema (XSD) and denormalize it to a simple form containing no refs, no includes, etc.  All simple type definitions should be inline, such that when looking at any given element, all declarations are visible without performing another lookup.</p>
  
  <p>I've found some tools that have this built-in, but I need to do it "on the fly."  Platform of choice is Java, but I'd be willing to port the code from another language if necessary.  I just really don't want to reinvent the wheel here.  Searching for OSS libraries from Apache/etc have yielded nothing.  The closest I've found is XSOM which supports traversing a schema as an object model, but you still have to handle every possible form that a schema could take to represent a given structure.</p>
  
  <p>The output doesn't have to be actual XML, as it will actually be used in a object model in its final form.</p>