Problem with develop of XML Schema based on an existent XML
Posted
by farhad
on Stack Overflow
See other posts from Stack Overflow
or by farhad
Published on 2010-06-15T12:30:44Z
Indexed on
2010/06/15
12:32 UTC
Read the original article
Hit count: 897
Xml
|xml-schema
Hello! I have a problem with the validation of this piece of XML:
<?xml version="1.0" encoding="UTF-8"?>
<i-ching xmlns="http://www.oracolo.it/i-ching">
<predizione>
<esagramma nome="Pace">
<trigramma>
<yang/><yang/><yang/>
</trigramma>
<trigramma>
<yin/><yin/><yin/>
</trigramma>
</esagramma>
<significato>Questa combinazione preannuncia
<enfasi>boh</enfasi>, e forse anche <enfasi>mah,
chissa</enfasi>.</significato>
</predizione>
<predizione>
<esagramma nome="Ritorno">
<trigramma>
<yang/><yin/> <yin/>
</trigramma>
<trigramma>
<yin/><yin/><yin/>
</trigramma>
</esagramma>
<significato>Si prevede con certezza <enfasi>qualcosa</enfasi>,
<enfasi>ma anche <enfasi>no</enfasi></enfasi>.</significato>
</predizione>
</i-ching>
This XML Schema was developed with Russian Dolls technique:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.oracolo.it/i-ching"
targetNamespace="http://www.oracolo.it/i-ching"
>
<xsd:element name="i-ching">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="predizione" minOccurs="0" maxOccurs="64">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="esagramma">
<xsd:complexType>
<!-- vi sono 2 trigrammi -->
<xsd:sequence>
<xsd:element name="trigramma" minOccurs="2" maxOccurs="2">
<xsd:complexType>
<xsd:sequence minOccurs="3" maxOccurs="3">
<xsd:choice>
<xsd:element name="yang"/>
<xsd:element name="yin"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="nome" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<!-- significato: context model misto -->
<xsd:element name="significato">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="enfasi" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
For exercise I have to develop an XML Schema to validate the previous XML. The problem is that oxygen says me this:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'predizione'. One of '{predizione}' is expected. Start location: 3:6 End location: 3:16 URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
why? is it something wrong with my xml schema? thank you very much
© Stack Overflow or respective owner