posted 16 years ago
I am trying to validate some XML against an XML schema.
I am getting the error:
[Error] :9:12: cvc-complex-type.2.3: Element 'memories' cannot have character [children], because the type's content type is element-only.
My schema is:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="memories">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="memory" type="memoryType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="memoryType">
<xsd:sequence>
<xsd:element name="subdate" type="xsd:string"/>
<xsd:element name="donor" type="xsd:string"/>
<xsd:element name="subject" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="tapeid" type="xsd:int"/>
</xsd:complexType>
</xsd:schema>
And my XML is:<?xml version="1.0" encoding="UTF-8"?>
<memories xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation=memories.xsd'>>
<memory tapeid="23412">
<subdate>5/23/2001</subdate>
<donor>John Baker</donor>
<subject>Fishing off Pier 60</subject>
</memory>
</memories>