XML-schema bevat Element
❮ Volledige XML-schemareferentie
Definitie en gebruik
Het include-element wordt gebruikt om meerdere schema's met dezelfde doelnaamruimte aan een document toe te voegen.
Elementinformatie
- Bovenliggende elementen: schema
Syntaxis
<include
id=ID
schemaLocation=anyURI
any attributes
>
(annotation?)
</include>
(Het ?-teken geeft aan dat het element nul of één keer binnen het include-element kan voorkomen)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
schemaLocation | Required. Specifies the URI to the schema to include in the target namespace of the containing schema |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
voorbeeld 1
Bij opgenomen schema's moeten de opgenomen bestanden allemaal verwijzen naar dezelfde doelnaamruimte. Als de naamruimte van het schemadoel niet overeenkomt, werkt de include niet:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com/schema">
<xs:include schemaLocation="https://www.w3schools.com/xml/customer.xsd"/>
<xs:include schemaLocation="https://www.w3schools.com/xml/company.xsd"/>
..
..
..
</xs:schema>
❮ Volledige XML-schemareferentie