validation error [ There is no ID/IDREF binding for IDREF ] - validation

I am getting this error message when validating my XML file against its Schema. Can anyone suggest what might be wrong? The XML file is:
<?xml version="1.0"?>
<family-tree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ftree.xsd">
<person id="p5">
<name>
<given>Al Frank</given>
<surname>Smith</surname>
</name>
</person>
<person id="p6">
<name>
<given>Henry</given>
<surname>Smith</surname>
</name>
<father ref="p5"/>
</person>
</family-tree>
The schema is:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:element name="family-tree">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="person" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="father" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="id" use="required" type="xsd:ID"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="name">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="given"/>
<xsd:element minOccurs="0" name="surname"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="given" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>
<xsd:element name="father">
<xsd:complexType>
<xsd:attribute name="ref" use="required" type="xsd:IDREF"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Which XML parser are you using? Perhaps your parser doesn't like the fact that you have an id that is not referenced anywhere in the document. However, I don't remember reading about such a requirement. Perhaps adding standalone="no" to the XML declaration (<?xml version="1.0" standalone="no"?>) will help?

Related

gSoap wsdl2h.exe doesn't generate file

I'm trying to create a soap web service client in C using gSoap under Windows server 2022.
I tried to use wsdl2h to convert WSDL file to generate interface header files for soapcpp2, but I obtained an empty file.
When I execute wsdl2h I have this message:
The WSDL file is:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:eda-sw-schemas/page/salesorder" targetNamespace="urn:eda-sw-schemas/page/salesorder">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:eda-sw-schemas/page/salesorder">
<xsd:simpleType name="Job_Queue_Status">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_"/>
<xsd:enumeration value="Scheduled_for_Posting"/>
<xsd:enumeration value="Error"/>
<xsd:enumeration value="Posting"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Status">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Open"/>
<xsd:enumeration value="Released"/>
<xsd:enumeration value="Pending_Approval"/>
<xsd:enumeration value="Pending_Prepayment"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Prepmt_CM_Refers_to_Period">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_"/>
<xsd:enumeration value="Current"/>
<xsd:enumeration value="Current_Calendar_Year"/>
<xsd:enumeration value="Previous_Calendar_Year"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Type">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_"/>
<xsd:enumeration value="G_L_Account"/>
<xsd:enumeration value="Item"/>
<xsd:enumeration value="Resource"/>
<xsd:enumeration value="Fixed_Asset"/>
<xsd:enumeration value="Charge_Item"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="IC_Partner_Ref_Type">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_"/>
<xsd:enumeration value="G_L_Account"/>
<xsd:enumeration value="Item"/>
<xsd:enumeration value="Charge_Item"/>
<xsd:enumeration value="Cross_Reference"/>
<xsd:enumeration value="Common_Item_No"/>
<xsd:enumeration value="Vendor_Item_No"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Prepmt_CM_Refers_to_Period_12139">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="_blank_"/>
<xsd:enumeration value="Current"/>
<xsd:enumeration value="Current_Calendar_Year"/>
<xsd:enumeration value="Previous_Calendar_Year"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="Sales_Order_Line">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Type" type="tns:Type"/>
<xsd:element minOccurs="0" maxOccurs="1" name="FilteredTypeField" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Include_in_VAT_Transac_Rep" type="xsd:boolean"/>
<xsd:element minOccurs="0" maxOccurs="1" name="IC_Partner_Ref_Type" type="tns:IC_Partner_Ref_Type"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Prepmt_CM_Refers_to_Period" type="tns:Prepmt_CM_Refers_to_Period_12139"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Requested_Delivery_Date" type="xsd:date"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Whse_Outstanding_Qty" type="xsd:decimal"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Appl_from_Item_Entry" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Sales_Order_Line_List">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="Sales_Order_Line" type="tns:Sales_Order_Line"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SalesOrder">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Key" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="No" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_No" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Sell_to_Customer_Name" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Job_Queue_Status" type="tns:Job_Queue_Status"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Status" type="tns:Status"/>
<xsd:element minOccurs="0" maxOccurs="1" name="SalesLines" type="tns:Sales_Order_Line_List"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SalesOrder_List">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="SalesOrder" type="tns:SalesOrder"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="SalesOrder_Fields">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="No"/>
<xsd:enumeration value="Sell_to_Customer_No"/>
<xsd:enumeration value="Sell_to_Customer_Name"/>
<xsd:enumeration value="Job_Queue_Status"/>
<xsd:enumeration value="Status"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="SalesOrder_Filter">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="Field" type="tns:SalesOrder_Fields"/>
<xsd:element minOccurs="1" maxOccurs="1" name="Criteria" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ReadMultiple">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="filter" type="tns:SalesOrder_Filter"/>
<xsd:element minOccurs="0" maxOccurs="1" name="bookmarkKey" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="setSize" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ReadMultiple_Result">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ReadMultiple_Result" type="tns:SalesOrder_List"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="ReadMultiple">
<part name="parameters" element="tns:ReadMultiple"/>
</message>
<message name="ReadMultiple_Result">
<part name="parameters" element="tns:ReadMultiple_Result"/>
</message>
<portType name="SalesOrder_Port">
<operation name="ReadMultiple">
<input name="ReadMultiple" message="tns:ReadMultiple"/>
<output name="ReadMultiple_Result" message="tns:ReadMultiple_Result"/>
</operation>
</portType>
<binding name="SalesOrder_Binding" type="tns:SalesOrder_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ReadMultiple">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:eda-sw-schemas/page/salesorder:ReadMultiple" style="document"/>
<input name="ReadMultiple">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="ReadMultiple_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="SalesOrder_Service">
I tried under linux and the .h files are correctly generated.
what I'm doing wrong ?

JAXB does not create enum for restricted element

I need some help with my xsd and jaxb.
My xsd leads to an working class (MyWorkingType) and the 'ProblemType', which is not generated with an enum.
As I believe, that both forms are valid, why does this not work, where is the bug (jaxb or at the keyboard?)
Edit: I add my ant-script, because Xtian could create this via maven-plugin.
This is my xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ProblemType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="workingEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MyWorkingType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute" type="workingEnum" />
</xs:sequence>
</xs:complexType>
</xs:schema>
This is my ant-script I use within eclipse:
<?xml version="1.0" encoding="UTF-8"?>
<project name="generate" default="generate-jaxb" basedir=".">
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
<classpath>
<fileset dir="../lib" includes="*.jar" />
</classpath>
</taskdef>
<target name="generate-jaxb">
<xjc destdir="../../src-gen" package="test.gen">
<arg value="-no-header" />
<schema dir="xsd/" includes="*.xsd"/>
</xjc>
</target>
</project>
Try specifying typesafeEnumBase. This is what I normally do when generating mappings:
<jaxb:bindings schemaLocation="mySchema.xsd"
node="/xs:schema">
<jaxb:globalBindings
fixedAttributeAsConstantProperty="false"
typesafeEnumBase="xs:string"
typesafeEnumMemberName="generateName"
generateIsSetMethod="true">
<xjc:noValidator />
<xjc:noValidatingUnmarshaller />
</jaxb:globalBindings>
<jaxb:schemaBindings>
<jaxb:package name="my.package.name"/>
</jaxb:schemaBindings>
</jaxb:bindings>
However I don't think this is the cause.
Since my maven-jaxb2-plugin works and xjc via Ant does not, the question, what is the difference.
Actually, strict, verbose and extension settings should make no difference for enums.
However it may be that maven-jaxb2-plugin uses a newer version of xjc than you're using with enum. Please try to update your xjc and see if it helps.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ProblemType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute">
<xs:simpleType name="problemTypeEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="workingEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MyWorkingType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute" type="workingEnum" />
</xs:sequence>
</xs:complexType>
</xs:schema>
I generated the class by this maven plugin
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.9.0</version>
<executions>
<execution>
<id>commun-generate</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<generateDirectory>${basedir}/src/main/java/</generateDirectory>
<schemaDirectory>${basedir}/src/main/resources/schema/xsd</schemaDirectory>
<strict>false</strict>
<extension>true</extension>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
ProblemTypeEnum.java
#XmlType(name = "problemTypeEnum")
#XmlEnum
public enum ProblemTypeEnum {
VALUE_1,
VALUE_2,
VALUE_3;
public String value() {
return name();
}
public static ProblemTypeEnum fromValue(String v) {
return valueOf(v);
}
}
If you can change the structure .. this is the xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ProblemType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true"
type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute"
type="problemTypeEnum" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="problemTypeEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="workingEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="VALUE_1" />
<xs:enumeration value="VALUE_2" />
<xs:enumeration value="VALUE_3" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MyWorkingType">
<xs:sequence>
<xs:element minOccurs="0" name="normalAttribute" nillable="true"
type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="1" name="enumAttribute"
type="workingEnum" />
</xs:sequence>
</xs:complexType>
</xs:schema>

Different .xsd using xsd.exe and VisualStudio->Xml->CreateSchema

I have foo.xml, I would like to generate foo.xsd as it is generated with VisualStudio->Xml->CreateSchema, tried xsd.exe but results are not the same. (xsd.exe foo.xml)
How to call same command as VisualStudio->Xml->CreateSchema from command line?
Maybe one small example will help, notce type="xs:string" minOccurs="0" When xml is more complexed differences become huge.
xml:
<foo>
<x />
<y />
</foo>
VS:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="x" />
<xs:element name="y" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
xsd.exe
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="x" type="xs:string" minOccurs="0" />
<xs:element name="y" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="foo" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Looks like it could be that Visual Studio is using XmlSchemaInference.InferSchema internally instead of xsd.exe? More information on XmlSchemaInference.InferSchema.

How to create a object to access a Complex type names in WSDL using savon

I am a newbie for SAVON and ruby this is my first assignment from my client. So any help is greatly appreciated.
<complexType name="CEvent">
<annotation>
<documentation>The base used for all events. All events extend this structure.</documentation>
</annotation>
<complexContent>
<extension base="ttns:CItemWithDBRecordId">
<sequence>
<element name="user" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="date" type="xsd:dateTime" minOccurs="1" maxOccurs="1" nillable="false" />
<element name="notes" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="eventaddorder" type="xsd:short" minOccurs="1" maxOccurs="1" />
<element name="name" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="parenteventid" type="xsd:long" minOccurs="0" maxOccurs="1" />
<element name="attachmentlist" type="ttns:ArrayOfCFileAttachment" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="fieldlist" type="ttns:ArrayOfCField" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="resultingstate" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="hours" type="xsd:double" minOccurs="0" maxOccurs="1" />
<element name="assigntolist" type="ttns:ArrayOfstring" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="releasenotesversion" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="generatedeventtype" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="generatedbyname" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="totaltimespent" type="xsd:double" minOccurs="0" maxOccurs="1" />
<element name="overrideuser" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
<element name="marksuspect" type="xsd:boolean" minOccurs="0" maxOccurs="1" />
</sequence>
</extension>
</complexContent>
</complexType>
and i dont know how to get that and also need to update the fields of the elements with my input data.
I am accessing it the Complex name this way.
response = #client.request 'CEvent'
and the response that i got is
(SOAP-ENV:Client) Method 'ins0:CEvent' not implemented: method name or namespac
not recognized
Im sure that this is not the way,as its not a method name , so im still scratching my head to resolve this.!!
I just recently completed a project using SAVON to access SOAP services on Microsoft SharePoint. You should be able to access the response data using the hash value returned by the Savon request.
response.hash[:annotation][:complexContent][:sequence]
Have a look at the article on my web site below. It is not specific to your requirement but might help.
http://mark.stratmann.me/content_items/using-savon-to-connect-to-microsoft-sharepoint-soap-services-in-rails-3-2

XML: How to place a restriction to a base simple element which was extended with attributes?

I have the following xml:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<Child name="MyType" compareMode="EQ">Child1</Child>
</Root>
Usually in order to verify such an xml one would use the following xml schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="Child">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="compareMode" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I want to limit values of a Child element and allow only the following: Child1, Child2 and Child3.
I know that usually restriction may be specified with the following schema:
<xs:restriction base="xs:string">
<xs:enumeration value="Child1"/>
<xs:enumeration value="Child2"/>
<xs:enumeration value="Child3"/>
</xs:restriction>
Which restriction is correct in the first case?
Does this answer your question?
Having both an attribute and a restriction on an element in xml schema
I was wrong, because I didn't test my answer. I edited it:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="ChildContent">
<xs:restriction base="xs:string">
<xs:enumeration value="Child1"/>
<xs:enumeration value="Child2"/>
<xs:enumeration value="Child3"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Child">
<xs:simpleContent>
<xs:extension base="ChildContent">
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="compareMode" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="Child" type="Child" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
or with restriction:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Child">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="compareMode" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="Child">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="Child">
<xs:enumeration value="Child1"/>
<xs:enumeration value="Child2"/>
<xs:enumeration value="Child3"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
After hours spent with google: You cannot do this without named types.

Resources