What's the difference between xsd:include
and xsd:import
? When would you use one instead of the other, and when might it not matter?
In short, the import element allows you to use schema components from any schema; the include element allows you to add all the components of an included schema to the containing schema.
Definition and Usage The import element is used to add multiple schemas with different target namespace to a document.
Differences: XSD is based and written on XML. XSD defines elements and structures that can appear in the document, while XML does not. XSD ensures that the data is properly interpreted, while XML does not.
The fundamental difference between include
and import
is that you must use import
to refer to declarations or definitions that are in a different target namespace and you must use include
to refer to declarations or definitions that are (or will be) in the same target namespace.
Source: https://web.archive.org/web/20070804031046/http://xsd.stylusstudio.com/2002Jun/post08016.htm
Use xsd:include to bring in an XSD from the same or no namespace.
Use xsd:import to bring in an XSD from a different namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With