"ExcludeIncludedTypes" Setting??

Dec 7, 2012 at 4:29 PM

Either I don't understand what the "ExcludeIncludedTypes" setting is supposed to do or it doesn't work right...

I have the following schema definition - notice the included schema and its use (bold text below):

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://foo.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:include schemaLocation=".\CloudWallMaterialParameters.xsd" />
    <xs:complexType name="MaterialParametersType">
        <xs:choice>
            <xs:element name="CloudWallMaterialParameters" xmlns:q2="http://foo.com/" type="q2:CloudWallMaterialParametersType" />
        </xs:choice>
    </xs:complexType>
    <xs:element name="MaterialConfiguration">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="ProductId" type="xs:string" />
                <xs:element name="MaterialParameters" xmlns:q1="http://foo.com/" type="q1:MaterialParametersType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

When I set "ExcludeIncludedTypes" in Xsd2Code, I am expecting that the generated code for this schema should not include a definition for CloudWallMaterialParametersType since that complex type is defined in the included CloudWallParameters.xsd, but it does. This causes problems with other schemas in the same project that also include the CloudWallParameters.xsd schema and reference it.

Any suggestions would be appreciated.

Coordinator
Dec 9, 2012 at 2:35 PM

Hi,

Thank you to have reported this bug.

You can download the fix here : http://xsd2code.codeplex.com/releases/view/98851

Tell me please if it work fine for you.

Pascal.

Dec 17, 2012 at 3:30 PM
Edited Dec 17, 2012 at 4:16 PM

The new build doesn't appear to have fixed the bug I reported.

[edit] After a bit of investigation, it appears that the download link isn't pointed to the 3.6 beta build - the installed files still have a date of 2010 on them and a version of 3.5

I grabbed the latest code from the repository, built and installed, and the version is now shown as 3.6

The code generation behavior with ExcludeIncludedTypes is better, but...

In my case, I have a nested hierarchy of includes - a.xsd includes b.xsd which includes c.xsd

In the generated code from the latest build, the code generated from a.xsd no longer includes a class definition for the types in b.xsd, but DOES still include the class definition for the types in c.xsd - so there's still a bit of a bug.

 

 

Coordinator
Dec 17, 2012 at 7:24 PM

I understand the problem better. I'll have to incorporate a recursive processing to eliminate all types.

I think I'll be able to finish now.

Thank you to have reported this issue.

Pascal.

Coordinator
Dec 24, 2012 at 9:17 AM

Hi,

fix is done in this new alpha release : http://xsd2code.codeplex.com/releases/view/98851

It works fine for me with 3 levels of included schema.

Thank you, if you can test it in your context.

Merry Christmas all !

Pascal.

Jan 2, 2013 at 7:30 PM

Hi Pascal - I downloaded the latest alpha and it seems to work very well now. Thanks for all your effort on this bug! It has made it possible for me to use Xsd2Code in my project.

Jan 18, 2013 at 11:34 AM

I install the version 3.6 because i need this to work with XSD files, but in some files, it crashes my Visual Studio 2010.

Can anyone help me?

 

Thanks

Feb 7, 2013 at 12:04 PM
Running Xsd2Code with ExcludeIncludedTypes=true crashes my Visual Studio 2012 too. It also crashes when running from command line.