gl_team_bleu/div/xmlschemas/schema.xsd

120 lines
5.3 KiB
XML
Raw Normal View History

2025-07-12 19:18:13 +02:00
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="network">
<xs:complexType>
<xs:sequence>
<!-- main_description must be the first sub-element of network (impossible to allow unspecified elements before main_description if the document is parsed by an event-based parser) -->
<xs:element name="main_description" type="main_descr_type">
<!-- the layer id must be unique within the network -->
<xs:unique name="unique_layer_id">
<xs:selector xpath="./layer"/>
<xs:field xpath="./@id"/>
</xs:unique>
<!-- the node id must be unique within the network and will be referenced by link/@orig and link/@dest -->
<xs:key name="key_node_id">
<xs:selector xpath="./*/node"/>
<xs:field xpath="@id"/>
</xs:key>
<!-- the origine of a link must reference an existing node id -->
<xs:keyref name="keyref_link_orig" refer="key_node_id">
<xs:selector xpath="./*/link"/>
<xs:field xpath="@orig"/>
</xs:keyref>
<!-- the destination of a link must reference an existing node id -->
<xs:keyref name="keyref_link_dest" refer="key_node_id">
<xs:selector xpath="./*/link"/>
<xs:field xpath="@dest"/>
</xs:keyref>
</xs:element>
<!-- COMMENT THE TWO NEXT ELEMENTS IF YOU DON'T WANT TO USE THEM IN THIS ORDER -->
<xs:element name="additional_description" minOccurs="0">
<!-- the content of additional_description is not specified -->
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="graphical_data" minOccurs="0">
<!-- the content of graphical_data is not specified -->
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- allow to have other (unspecified) sub-elements of network -->
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- content of the main_description element : -->
<xs:complexType name="main_descr_type">
<xs:sequence>
<xs:element name="layer" maxOccurs="unbounded">
<!-- content of layer elements -->
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="node">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<!-- specified attributes of node should be added in the "node_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="node_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
<xs:element name="link">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<!-- specified attributes of link should be added in the "link_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="link_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
</xs:choice>
<!-- specified attributes of layer should be added in the "layer_specified_att" attribute group at the bottom of this document -->
<xs:attributeGroup ref="layer_specified_att"/>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
<!-- the couple (orig, dest) of a link must be unique within a layer -->
<xs:unique name="unique_orig_dest">
<xs:selector xpath="./link"/>
<xs:field xpath="@orig"/>
<xs:field xpath="@dest"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- describe the authorized type for positions, i.e. an integer or a geographical coordinate -->
<xs:simpleType name="position_type">
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d{1,2}(\.\d{1,2})?\s*[ENSW]"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- ADD HERE THE ATTRIBUTES YOU WANT TO SPECIFY FOR THE CORRESPONDING NETWORK OBJECT -->
<!-- Specified attributes of layer : -->
<xs:attributeGroup name="layer_specified_att">
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:attributeGroup>
<!-- Specified attributes of node : -->
<xs:attributeGroup name="node_specified_att">
<xs:attribute name="id" type="xs:integer" use="required"/>
<xs:attribute name="label" type="xs:string" use="optional"/>
<xs:attribute name="pos_x" type="position_type" use="required"/>
<xs:attribute name="pos_y" type="position_type" use="required"/>
</xs:attributeGroup>
<!-- Specified attributes of link : -->
<xs:attributeGroup name="link_specified_att">
<xs:attribute name="orig" type="xs:integer" use="required"/>
<xs:attribute name="dest" type="xs:integer" use="required"/>
</xs:attributeGroup>
</xs:schema>