What does “When <simpleContent> is used, the base type must be a complexType whose content type is simple…” even mean?

StackOverflow https://stackoverflow.com/questions/3505923

Question

Here's the whole error I keep getting from xerces....

When <simpleContent> is used, the base type must be a complexType whose content type 
is simple, or, only if restriction is specified, a complex type with mixed content
and emptiable particle, or, only if extension is specified, a simple type.
'string' satisfies none of these conditions.

I thought I understood this, but after getting it several times I must have lost it, anyone have a good "spin" on it

I've narrowed it down to this element

<xs:element name="Note">
  <xs:complexType>
    <xs:simpleContent>
      <xs:restriction base="xs:string">
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

I think I've just been starring to long at the project...

Was it helpful?

Solution

It looks like you want

<xs:extension base="xs:string">

instead of

<xs:restriction base="xs:string">

E.g. see XML Schema: Content Types, second code snippet.

I'm making assumptions about what the Note element can be. If the above doesn't match what you're trying to accomplish, please describe whether you want the Note element to be able to have attributes, and/or text content, and/or child elements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top