0

Is there a way i can automatically remove all circular group references from an XSD schema?

I'm trying to run svcutil.exe and xsd.exe on an OGC schema and get the following error:

Error: Group 'AnyScalar' from targetNamespace='http://www.opengis.net/swe/1.0' has invalid definition: Circular group reference.

The schema is too big to go through it manually.

This is the schema i'm using: http://schemas.opengis.net/sps/1.0.0/spsAll.xsd

capdragon
  • 14,565
  • 24
  • 107
  • 153

1 Answers1

1

AnyScalar is found in http://schemas.opengis.net/sweCommon/1.0.0/simpleTypes.xsd

I cant find a problem with it. The entire schema set validates in Liquid XML Studio (I can't vouch for it's reliability, I've not used it much). The simpleTypes schema also validates. I've dug a bit deeper into the definition and there's nothing there that looks like a circular reference to me.

This is the group definition:

<xs:group name="AnyScalar">
    <xs:annotation>
        <xs:documentation>Re-usable group providing a choice of scalar data types</xs:documentation>
    </xs:annotation>
    <xs:choice>
        <xs:group ref="swe:AnyNumerical"/>
        <xs:element ref="swe:Boolean"/>
        <xs:element ref="swe:Category"/>
        <xs:element ref="swe:Text"/>
    </xs:choice>
</xs:group>

You might also find this a helpful resource: http://www.botts-inc.net/SensorML_1.0.1/schemaBrowser/SensorML_AnyScalar.html#Link1BB6C530

Edit: it looks like your problem isn't with the schemas at all: http://www.ogcnetwork.net/node/1317

It's just that code generation tools can't deal with them - hardly surprising that a schema set built on GML will test the limits of those utilities.

James Walford
  • 2,953
  • 1
  • 24
  • 37
  • I agree. Databinding is not the right way to handle XML with a schema as complex as GML. You're better off using XSLT or XQuery to extract the subset of the information you need into something much simpler. – Michael Kay Jan 28 '11 at 21:51
  • 2
    Unfortunately it's precisely when a schema gets a bit hairy that people most want a tool to do their data binding for them! – James Walford Jan 28 '11 at 21:55
  • I know you would think tools are made for the larger schemas. Are you saying i should bite the bullet and do it all manually? – capdragon Jan 31 '11 at 14:34
  • Well as Michael Kay says, you'll probably need to do some sort of preprocessing first, if you can simplify things then all the better. the good news though is that others have gone before you: http://www.ogcnetwork.net/node/1317 – James Walford Jan 31 '11 at 19:52
  • Could you please elaborate on the preprocessing? Do you have any links as to how i would go about that? – capdragon Feb 02 '11 at 16:27
  • Sorry, can't help, don't know much about it. I put this question out after reading yours though: http://stackoverflow.com/questions/4842818/what-are-the-limits-to-code-generation-from-xml-schema-in-c Perhaps you could ask a more specific question? – James Walford Feb 02 '11 at 19:25