[xsd-users] xsd:include

Boris Kolpackov boris at codesynthesis.com
Mon Jun 15 14:50:06 EDT 2009


Hi Al,

Al Niessner <Al.Niessner at jpl.nasa.gov> writes:
 
> Unfortunate, but I can deal with it. It is interesting that you point
> out reuse as a reason for the include. I am reusing a.xsd in the sense
> that b.xsd builds a more complex type that uses what is defined in
> a.xsd. In some sense, b.xsd inherits a.xsd. Not really and nor does it
> extend a.xsd but it certainly requires it. Hence, I am making my schema
> more manageable and reusing it to its fullest.

Yes, that's the technique that I refer to, provided you xsd:include
a.xsd in b.xsd. There are, however, cases where people would have
a.xsd and b.xsd depend on types from each other. From the re-usability
point of view, such an arrangement is the same as where everything is
defined in one schema.

 
> I just find it surprising that your first statement implies that people
> make a bunch of atomic types and then include those in one final schema
> rather than layering it and adding complexity slowly. 

I certainly didn't mean to imply this ;-). The XSD compiler provides
good support for common use cases of xsd:include and provides fall-back
support (the file-per-type mode) for others. The well supported approach
boils down to having self-sufficient schema files (i.e., they include
all the schemas that they use instead of relying on one "top" schema
to include everything) and they don't have include cycles (actually,
XSD is able to generate working code for mutually included schemas
as long as the dependencies do not involve type inheritance).

Boris




More information about the xsd-users mailing list