I'm building an xml schema for this xml:
<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns:xsi="http://ift.tt/ra1lAU"
xsi:noNamespaceSchemaLocation="basic.xsd">
<!--Comienza la descripción de los grupos sencillos-->
<!--modificador-->
<group tagName="A">
<name>modificador</name>
<type>simple</type>
<words>
<word>el<word>
<word>este<word>
</words>
</group>
<!--prefijos-->
<group tagName="C">
<name>prefijos</name>
<type>simple</type>
<words>
<word>pre</word>
<word>ante</word>
<word>anti</word>
<word>pro</word>
<word>tri</word>
</words>
</group>
<!--Composiciones de intérvalos-->
</groups>
And this is my xsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://ift.tt/tphNwY">
<!-- definition of simple elements -->
<xs:element name="name" type="xs:string"/>
<xs:element name="type" type="xs:string"/>
<xs:element name="word" type="xs:string"/>
<!-- definition of attributes -->
<xs:attribute name="tagName" type="xs:ID"/>
<!-- definition of complex elements -->
<xs:element name="words">
<xs:complexType>
<xs:sequence>
<xs:element ref="word" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="group">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="type"/>
<xs:element ref="words" />
</xs:sequence>
<xs:attribute ref="tagName" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="groups">
<xs:complexType>
<xs:sequence>
<xs:element ref="group" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I'm using nokogiri to validate my xml, but I'm getting the following error:
Element 'word': Element content is not allowed, because the type definition is simple. XML not schema valid
Why should word be complex then? And how do I do that because to me it's just fine. Thanks in advanced.
No comments:
Post a Comment