Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7182631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:48:39+00:00 2026-05-28T17:48:39+00:00

I am trying to build a C# class from a XSD file. In short

  • 0

I am trying to build a C# class from a XSD file. In short I’m getting a circular reference error when trying to execute the XSD.exe tool:

Group ‘setFilterCondition’ from
targetNamespace=’http://developer.cognos.com /schemas/report/7.0/’ has
invalid definition: Circular group reference.

I pulled the definition of the group and I have the following XSD for it:

<xs:group name="setFilterCondition">
        <xs:annotation>
            <xs:documentation>Represents a simple or compound set filter condition</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="setFilterAnd">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:group ref="setFilterCondition" minOccurs="2" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="setFilterOr">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:group ref="setFilterCondition" minOccurs="2" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="setFilterNot">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                </xs:annotation>
                <xs:complexType>
                    <xs:group ref="setFilterCondition"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="memberCaptionCondition">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                    <xs:documentation>Defines a condition against the member caption.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:attribute name="operator" use="required">
                        <xs:annotation>
                            <xs:documentation source="doc_att_filterCondition_operator"/>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="contains">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_contains"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="beginsWith">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_beginsWith"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="endsWith">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_endsWith"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="matches">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_matches"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="containsNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_containsNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="beginsWithNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_beginsWithNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="endsWithNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_endsWithNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="matchesNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_memberCaptionCondition_operator_matchesNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="value" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="stringPropertyCondition">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                    <xs:documentation>Defines a condition against a string member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:all>
                        <xs:element ref="dmMemberProperty"/>
                    </xs:all>
                    <xs:attribute name="operator" use="required">
                        <xs:annotation>
                            <xs:documentation source="doc_att_filterCondition_operator"/>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="contains">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_contains"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="beginsWith">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_beginsWith"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="endsWith">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_endsWith"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="matches">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_matches"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="containsNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_containsNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="beginsWithNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_beginsWithNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="endsWithNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_endsWithNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="matchesNot">
                                    <xs:annotation>
                                        <xs:documentation source="doc_enum_stringPropertyCondition_operator_matchesNot"/>
                                    </xs:annotation>
                                </xs:enumeration>
                                <xs:enumeration value="isNull"/>
                                <xs:enumeration value="isNotNull"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="value" type="xs:string" use="optional"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="numericPropertyCondition">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                    <xs:documentation>Defines a numeric condition. The condition can be for either a tuple or a member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:all>
                        <xs:element ref="dmMemberProperty"/>
                    </xs:all>
                    <xs:attribute name="operator" use="required">
                        <xs:annotation>
                            <xs:documentation source="doc_att_filterCondition_operator"/>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="equal"/>
                                <xs:enumeration value="notEqual"/>
                                <xs:enumeration value="greaterThan"/>
                                <xs:enumeration value="greaterThanEqual"/>
                                <xs:enumeration value="lessThan"/>
                                <xs:enumeration value="lessThanEqual"/>
                                <xs:enumeration value="isNull"/>
                                <xs:enumeration value="isNotNull"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="value" type="xs:decimal" use="optional"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="tupleCondition">
                <xs:annotation>
                    <xs:documentation source="rn_added_7.0"/>
                    <xs:documentation>Defines a numeric condition. The condition can be for either a tuple or a member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:all>
                        <xs:element ref="dmTuple"/>
                    </xs:all>
                    <xs:attribute name="operator" use="required">
                        <xs:annotation>
                            <xs:documentation source="doc_att_filterCondition_operator"/>
                        </xs:annotation>
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="equal"/>
                                <xs:enumeration value="notEqual"/>
                                <xs:enumeration value="greaterThan"/>
                                <xs:enumeration value="greaterThanEqual"/>
                                <xs:enumeration value="lessThan"/>
                                <xs:enumeration value="lessThanEqual"/>
                                <xs:enumeration value="isNull"/>
                                <xs:enumeration value="isNotNull"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                    <xs:attribute name="value" type="xs:decimal" use="optional"/>
                </xs:complexType>
            </xs:element>
        </xs:choice>
</xs:group>

I see that it has sub groups that are of the same type of the parent. Why does this cause a circular reference? How can I edit this XSD to not cause the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:48:40+00:00Added an answer on May 28, 2026 at 5:48 pm

    The same was asked on SO a while ago… this is the post, with some answers.

    The solution I am proposing should be simpler, especially in your case where you can edit the XSD and the fact is the group itself fully describes the content of the element where is used.

    The trick is then to reuse and implement the recusivity of your content not through group reference, but through complex type. If you compare your schema to the mine below, you’ll notice how I’ve defined and used the complex type.

    Hopefully it’ll help someone else….

    The refactored XSD works with XSD.exe, the class generates clean, without any error.

    <?xml version="1.0" encoding="utf-8"?>
    <!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
    <xs:schema xmlns="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" targetNamespace="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:annotation>
            <xs:documentation>Generated from "Set2" under "Release1"</xs:documentation>
        </xs:annotation>
        <xs:element name="dmTuple" type="xs:string"/>
        <xs:element name="dmMemberProperty" type="xs:string"/>
        <xs:complexType name="setFilterConditionList">
            <xs:sequence minOccurs="2" maxOccurs="unbounded">
                <xs:group ref="setFilterCondition"/>
            </xs:sequence>      
        </xs:complexType>
        <xs:group name="setFilterCondition">
            <xs:choice>
                <xs:element ref="setFilterAnd">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="setFilterOr">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="setFilterNot">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                    </xs:annotation>
                </xs:element>
                <xs:element name="memberCaptionCondition">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                        <xs:documentation>Defines a condition against the member caption.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="operator" use="required">
                            <xs:annotation>
                                <xs:documentation source="doc_att_filterCondition_operator"/>
                            </xs:annotation>
                            <xs:simpleType>
                                <xs:restriction base="xs:string">
                                    <xs:enumeration value="contains">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_contains"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="beginsWith">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_beginsWith"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="endsWith">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_endsWith"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="matches">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_matches"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="containsNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_containsNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="beginsWithNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_beginsWithNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="endsWithNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_endsWithNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="matchesNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_memberCaptionCondition_operator_matchesNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="value" type="xs:string" use="required"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="stringPropertyCondition">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                        <xs:documentation>Defines a condition against a string member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:all>
                            <xs:element ref="dmMemberProperty"/>
                        </xs:all>
                        <xs:attribute name="operator" use="required">
                            <xs:annotation>
                                <xs:documentation source="doc_att_filterCondition_operator"/>
                            </xs:annotation>
                            <xs:simpleType>
                                <xs:restriction base="xs:string">
                                    <xs:enumeration value="contains">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_contains"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="beginsWith">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_beginsWith"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="endsWith">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_endsWith"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="matches">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_matches"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="containsNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_containsNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="beginsWithNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_beginsWithNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="endsWithNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_endsWithNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="matchesNot">
                                        <xs:annotation>
                                            <xs:documentation source="doc_enum_stringPropertyCondition_operator_matchesNot"/>
                                        </xs:annotation>
                                    </xs:enumeration>
                                    <xs:enumeration value="isNull"/>
                                    <xs:enumeration value="isNotNull"/>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="value" type="xs:string" use="optional"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="numericPropertyCondition">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                        <xs:documentation>Defines a numeric condition. The condition can be for either a tuple or a member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:all>
                            <xs:element ref="dmMemberProperty"/>
                        </xs:all>
                        <xs:attribute name="operator" use="required">
                            <xs:annotation>
                                <xs:documentation source="doc_att_filterCondition_operator"/>
                            </xs:annotation>
                            <xs:simpleType>
                                <xs:restriction base="xs:string">
                                    <xs:enumeration value="equal"/>
                                    <xs:enumeration value="notEqual"/>
                                    <xs:enumeration value="greaterThan"/>
                                    <xs:enumeration value="greaterThanEqual"/>
                                    <xs:enumeration value="lessThan"/>
                                    <xs:enumeration value="lessThanEqual"/>
                                    <xs:enumeration value="isNull"/>
                                    <xs:enumeration value="isNotNull"/>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="value" type="xs:decimal" use="optional"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="tupleCondition">
                    <xs:annotation>
                        <xs:documentation source="rn_added_7.0"/>
                        <xs:documentation>Defines a numeric condition. The condition can be for either a tuple or a member property. The value attribute must be provided for all operators except isNull and isNotNull.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:all>
                            <xs:element ref="dmTuple"/>
                        </xs:all>
                        <xs:attribute name="operator" use="required">
                            <xs:annotation>
                                <xs:documentation source="doc_att_filterCondition_operator"/>
                            </xs:annotation>
                            <xs:simpleType>
                                <xs:restriction base="xs:string">
                                    <xs:enumeration value="equal"/>
                                    <xs:enumeration value="notEqual"/>
                                    <xs:enumeration value="greaterThan"/>
                                    <xs:enumeration value="greaterThanEqual"/>
                                    <xs:enumeration value="lessThan"/>
                                    <xs:enumeration value="lessThanEqual"/>
                                    <xs:enumeration value="isNull"/>
                                    <xs:enumeration value="isNotNull"/>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:attribute>
                        <xs:attribute name="value" type="xs:decimal" use="optional"/>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:group>
        <xs:element name="setFilterAnd" type="setFilterConditionList"/>
        <xs:element name="setFilterOr" type="setFilterConditionList"/>
        <xs:element name="setFilterNot">
            <xs:complexType>
                <xs:group ref="setFilterCondition"/>
            </xs:complexType>
        </xs:element>   
    </xs:schema>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a generic class to work with entities from EF. This
im trying to invoke a specific class from within a jar file but I'm
I'm trying to build a class that inherits methods from Python's list, but also
I'm trying to build an example from GZipStream Class . With the command gmcs
I'm trying to build an error class and a lot of error classes I've
I am trying to build config file parser (c++ application)from scratch using tools like
I'm trying to build the proxy class for a web service using the wsdl
I am trying to build a little javascript class for geocoding addresses trough Google
I'm trying to build some .ascx controls into a class library for plugins for
I'm trying to build a better/more powerful form class for Django. It's working well,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.