• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Having trouble getting xml to validate

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It wouldn't be complaining about the whitespace, would it? If not then maybe it's complaining about the extra ">" character right after the start tag. Presumably it's escaped properly in the real document but it shows unescaped here because the forum does that.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic