Bonjour les pro du xml
J'essaie de mettre en place une xsd pour supprimer un warning dans un fichier xml. Alors j'ai la xsd suivante:
et le xml suivant:
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 <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://company.com/intranet/emailEvent/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://company.com/intranet/emailEvent/"> <xs:annotation> <xs:documentation>Schema used for email events configuration. Take a various list of email informations and associated events.</xs:documentation></xs:annotation> <xs:element name="reminder"> <xs:complexType> <xs:sequence> <xs:element name="email" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="event" type="EventType" minOccurs="1" maxOccurs="unbounded"> </xs:element> <xs:element name="from" type="addressType" minOccurs="1" maxOccurs="1"> </xs:element> <xs:element name="to" type="addressType" minOccurs="0" maxOccurs="unbounded"></xs:element> <xs:element name="bcc" type="addressType" minOccurs="0" maxOccurs="unbounded"></xs:element> <xs:element name="subject" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> <xs:element name="html" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> <xs:element name="text" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="emailType"> <xs:sequence> <xs:element name="event" type="EventType" minOccurs="1" maxOccurs="unbounded"> </xs:element> <xs:element name="from" type="addressType" minOccurs="1" maxOccurs="1"> </xs:element> <xs:element name="to" type="addressType" minOccurs="0" maxOccurs="unbounded"></xs:element> <xs:element name="bcc" type="addressType" minOccurs="0" maxOccurs="unbounded"></xs:element> <xs:element name="subject" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> <xs:element name="html" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> <xs:element name="text" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element> </xs:sequence> </xs:complexType> <xs:simpleType name="EventType"> <xs:restriction base="xs:string"></xs:restriction> </xs:simpleType> <xs:simpleType name="addressType"> <xs:restriction base="xs:string"></xs:restriction> </xs:simpleType> </xs:schema>
Seulement voilà, eclipse me souligne le <email> dans le xml avec ce message d'erreur:
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 <?xml version="1.0" encoding="UTF-8"?> <reminder xmlns="http://company.com/intranet/emailEvent/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:html="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://company.com/intranet/emailEvent/ ./emailEvent.xsd"> <email> <event>REMINDER</event> <from>service@company.com</from> <to>${email}</to> <subject>Rappel tâche: ${activityname}</subject> <html><![CDATA[ <p>Ceci est un email automatique. Ne pas répondre!<br/> Dit is een automatisch email. Niet beantwoorden!</p> <p> Ceci est un rappel de tâche à éxecuter intitulée <b>${activityname}</b>. Cette tâche fait partie du workflow intitulé <b>${processname}</b><br/> blablabla ]]> </html> <text><![CDATA[ Ceci est un email automatique. Ne pas répondre! Dit is een automatisch email. Niet beantwoorden! Vous avez reçu une nouvelle tâche intitulée *${activityname}*. Cette tâche fait partie du workflow intitulé *${processname}* blablabla ]]></text> </email> </reminder>
cvc-complex-type.2.4.a: Invalid content was found starting with element 'email'. One of '{email}' is expected.
Donc j'ai un peu de mal à capter le message d'erreur (je peux pas mettre email parce que je dois mettre email? )
Partager