Home Dashboard Directory Help

xsd.exe fails to handle circular group references by Wuzi


 as By Design Help for as By Design

Sign in
to vote
Type: Bug
ID: 637855
Opened: 1/24/2011 9:22:53 AM
Access Restriction: Public
User(s) can reproduce this bug


This schema is valid and often published by the industry, yet it XSD.exe gives an error trying to parse it.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://test" xmlns:t="http://test">

<xs:element name="elem1">
     <xs:group ref="t:grp1" />

<xs:group name="grp1">
     <xs:group ref="t:grp2" />

<xs:group name="grp2">
     <xs:element minOccurs="0" name="elem2">
         <xs:group ref="t:grp1" />

To run:

>"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\xsd.exe" tmp.xsd /c
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: Error generating classes for schema 'tmp'.
- Group 'grp2' from targetNamespace='http://test' has invalid definition: Circular group reference.

Issue #229705 was the original bug, and #624987 was an ignored attempt to reopen it. This is a critical functionality broken in the schema parsing classes, and has a high vote count.
Sign in to post a comment.
Posted by Microsoft on 5/12/2011 at 10:43 AM
Thanks for your feedback, according to the Model Group Validation section W3C XSD doc. Circular group refrences are not supported and the XSD.exe follows the specification.

Schema Component Constraint: Model Group Correct

All of the following must be true:

1 The values of the properties of a model group are as described in the property tableau in The Model Group Schema Component (§3.8.1), modulo the impact of Missing Sub-components (§5.3).

2 There are no circular groups. That is, within the {particles} of a group there is no particle at any depth whose {term} is the group itself.

If you feel that your scenario is differnt please re-activate this bug.
Posted by Microsoft on 1/24/2011 at 9:59 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.