Salut a tous,
je suis debutant en XML SCHEMA et je voulais savoir si on peux faire dans XS de la programmation conditionnelle.
Voici un exemple pour mieux comprendre ce que je veux faire :
J'ai le xml suivant :
et je voudrais par exemple pouvoir dire dans le schema si l'attribut element_type de l'element predicate-has-element est egal a SSR alors l'attribut property-name de l'element predicate-property-is est obligatoirement egal a CODE
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <predicate-n-ary-operator operator-type="AND"> <predicate-has-element element-type="SSR"> <matching-predicate> <predicate-property-is property-name="CODE"> <value>VGML</value> </predicate-property-is> </matching-predicate> </predicate-has-element> <predicate-has-element activity="added" element-type="AIR"/> <predicate-has-element activity="*" element-type="REMARK"> <matching-predicate> <predicate-property-is property-name="TYPE"> <value>RM</value> </predicate-property-is> </matching-predicate> </predicate-has-element> </predicate-n-ary-operator>
Voila le schema que j'ai deja fait mais il ne comporte pas les conditions :
Merci d'avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:element name="predicate-n-ary-operator"> <xsd:complexType> <xsd:choice minOccurs="2" maxOccurs="unbounded"> <xsd:element ref="predicate-has-element"/> </xsd:choice> <xsd:attribute name="operator-type" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="AND"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> <xsd:element name="predicate-has-element"> <xsd:complexType> <xsd:choice minOccurs="0" maxOccurs="1"> <xsd:element ref="matching-predicate"/> </xsd:choice> <xsd:attribute name="element-type" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="AIR"/> <xsd:enumeration value="REMARK"/> <xsd:enumeration value="SSR"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> <xsd:attribute name="activity"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="*"/> <xsd:enumeration value="added"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> <xsd:element name="matching-predicate"> <xsd:complexType> <xsd:choice minOccurs="1" maxOccurs="1"> <xsd:element ref="predicate-property-is"/> </xsd:choice> </xsd:complexType> </xsd:element> <xsd:element name="predicate-property-is"> <xsd:complexType> <xsd:choice minOccurs="1" maxOccurs="1"> <xsd:element ref="value"/> </xsd:choice> <xsd:attribute name="property-name" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="CODE"/> <xsd:enumeration value="TYPE"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> <xsd:element name="value" type="xsd:string"/> </xsd:schema>





Répondre avec citation





Partager