learning XMLSchema (comments)

This commit is contained in:
Jean Sirmai 2021-09-20 18:21:31 +02:00
parent 29fbf905d2
commit 7bde01ebad
Signed by untrusted user who does not match committer: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 36 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<identity>
<anything_but_not_just_the_word_name>Modèle de test</anything_but_not_just_the_word_name>
<name value="(Trois dimères)"/>
<owner_id>2</owner_id>
<owner>2</owner>
<date>1629830000</date>
<version>1.0</version>
</identity>
@ -42,7 +42,7 @@
<arrow x="1" y="0" z="0" site="0" weight="3"/>
</state>
<!-- Just for the fun ! Can you imagine some rules in a next model ? -->
<!-- Just for the fun ! Can you imagine adequate rules in a next model ? -->
<state id="dimer 1-2" date="1629830000" author="Jean Sirmai">
<arrow x="0" y="0" z="0" site="1" weight="1"/>
<arrow x="1" y="0" z="0" site="0" weight="2"/>

View File

@ -1,20 +1,40 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- https://www.freeformatter.com/xml-validator-xsd.html -->
<!-- https://www.w3schools.com/xml/el_attribute.asp -->
<!-- use="required" is NOT allowed in attributes declarations-->
<!-- Attribute 'name' Cannot Appear In Element 'element'.-->
<!-- To know : Attribute 'name' Cannot Appear In Element 'element'.-->
<!-- TODO
<BALISE>texte</BALISE> doit toujours être équivalent à <BALISE value="texte"/>
quelle que soit la BALISE et quel que soit le texte.
(excepté pour certaines balises sans texte)
Les balises concernées sont :
name, owner, date, version, max_thread, max_cycles,
dimension, site_multiplicity, boundaries, ref et quote
Comment déclarer cette équivalence ? -->
<!-- xs:element name="name" type="xs:string"/ -->
<xs:attribute name="id" type="xs:string"/>
<xs:attribute name="date" type="xs:integer"/> <!--TODO type ? -->
<xs:attribute name="name" type="xs:string"/> <!--TODO pas clair, ce truc... -->
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="lang" type="xs:string"/>
<xs:attribute name="value" type="xs:integer"/> <!--TODO WARNING: It's an integer !-->
<xs:attribute name="owner" type="xs:integer"/>
<xs:attribute name="author" type="xs:string"/>
<xs:attribute name="version" type="xs:float"/>
<xs:attribute name="owner_id" type="xs:integer"/>
<xs:attribute name="probability" type="xs:integer"/>
<!-- TO EVALUATE Consider using 'group' (?) or NOT -->
<!-- https://www.w3schools.com/xml/schema_complex_indicators.asp -->
<!-- TO EVALUATE Other definitions of an arrow (coord origin + dest,...) -->
<!-- TO EVALUATE Hypercubes pave the space => add a potential dimension 'w':
<xs:attribute name="w" type="xs:integer" default="0"/>-->
<xs:element name="arrow"> <!-- TODO Consider using 'group' : -->
<!-- https://www.w3schools.com/xml/schema_complex_indicators.asp -->
<xs:complexType>
@ -26,7 +46,16 @@
</xs:complexType>
</xs:element>
<!-- A state can be connex or not. A connex state is an object. -->
<!-- A state can be connex or not. A connex state is an object.
A transition goes from an origin (state) to a target.
Therefore, element 'State' is used in
- objects definitions,
- initial and produced/computed states declarations,
- origin and target declarations of a transition.
What attributes should always be associated to a state ? -->
<xs:element name="state">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
@ -66,7 +95,7 @@
</xs:complexType>
</xs:element>
<xs:element name="owner_id" type="xs:integer"/>
<xs:element name="owner" type="xs:integer"/>
<xs:element name="date" type="xs:integer"/>
<xs:element name="version" type="xs:float"/>