1) In your schema, you have flowspan
with the s
in lowercase in several places. Change that to flowSpan
.
2) You declared mixed
content, but your flowSpan
element is not optional, so it will always be required and will not validate it if the contents of flowSpan
don't contain another flowSpan
. Add minOccurs="0"
so it becomes optional.
3) You don't need to declare simple content if you have mixed content with an optional nested flowSpan
. Your schema could be reorganized using a reference for flowSpan
, since it's used recursively. You could try this:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/flow"
xmlns:tns="http://www.example.org/flow"
elementFormDefault="qualified">
<element name="edge">
<complexType>
<sequence>
<element name="flowPara" maxOccurs="unbounded">
<complexType mixed="true">
<sequence>
<element ref="tns:flowSpan" maxOccurs="unbounded"/>
</sequence>
<attribute name="style" type="string" />
<attribute name="id" type="string" />
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="flowSpan">
<complexType mixed="true">
<sequence>
<element ref="tns:flowSpan" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="style" type="string" />
</complexType>
</element>
</schema>