[oXygen-user] Automatically generating XML schemas using XSLT

Olumide videohead at mail.com
Wed Nov 21 12:27:17 CST 2012


Hello,

Following this tutorial 
(http://www.liquid-technologies.com/Tutorials/XmlSchemas/XsdTutorial_04.aspx 
-- don't worry, I use Oxygen ;-) ) I've refactored my 733 line schema 
into 16 separate files or sub-schemas, each with its own namespace. Now 
the top level schema is just 77 lines. The plan is to use these 
sub-schema's to build other top-level schemas.

The problem is that most top level schema's are quite similar and only 
differ in a few low level details. For example while one top level 
schema supports all PaymentMethodType's (see tutorial) another top-level 
schema may support only VISA and MasterCard. Currently my method of 
creating top-level schemas involves considerable duplication. For 
example, my current method of creating a top-level schema in which only 
VISA and MasterCard are supported would involve duplicating Main.xsd and 
OrderType.xsd, but customizing CommonTypes.xsd and reuse 
CustomerTypes.xsd. (As my actual schema is a lot longer a lot more 
duplication is involved.)

I find this duplication unacceptable primarily because it introduces a 
maintenance challenge i.e. I would have to maintain any number of 
identical sub-schemas with different names.

What I would like to know is if there is a method of automatically 
generating a schema without via a config file of some sort (XSLT 
perhaps?), in order to avoid duplicating sub-schemas.

Also, is it good practice for all the sub-schemas to declare the same 
target namespace in this case (just like the xml schema namespace xs, 
but have custom sub-schemas declare a separate namespace?

- Olumide



More information about the oXygen-user mailing list