[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Generating XSD Schema files from XML source files

Subject: Re: Generating XSD Schema files from XML source files
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 09 Nov 2010 14:51:20 +0000
Re:  Generating XSD Schema files from XML source files
Generating a schema for an XML file is a non-trivial task, unless of course you want to generate a trivial schema - one which every conceivable document conforms to. Of course there are an infinite number of schemas that any document conforms to: some of them might allow only that one document, and no others. So a lot depends on why you are doing it, and on how constraining you want the schema to be. It's not clear from your description whether you want a different schema for each source document (in which case you're not going to be able to hand-tune them at all), or whether you want a schema that all 500 source documents conform to.

All the IDEs such as Stylus Studio and oXygen have tools that will generate a schema from a source document, and they do a pretty respectable job, though the results need hand-tuning to be usable in practice. But they do tend to work on individual document instances rather than batches.

Doing it yourself in XSLT sounds like hard work. So although your question is on-topic for this forum, the answer isn't...

Michael Kay
Saxonica


On 09/11/2010 14:26, Neil Owens wrote:

I have a need to generate XSD Schema files from source XML files and I've no idea what would be the current 'best practice' way to go about it?


Just write an XSL transform that does the XML result file to Output and the schema to a result-document? Or something else/better?

I've approx 500 XML source files where parts of each one need placing into a database. What I've done so far, with Saxon9 and XSLT2, combined with this - http://msdn.microsoft.com/en-us/library/ms171806.aspx - does it all, except generating the Schema file.

TIA!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.