Subrata

I will appreciate any quick help on this:

I am trying to use xsd.exe to generate classes for a standard schema. I do not have any choice to modify the schemas. So if the tool has to work, it has to work on the existing schemas.

As I tried the following command line

xsd /c liberty-metadata-v1.1.xsd

I got the following warnings and errors:

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#Tongue Tiedignature' el
ement is not declared. Line 226, position 8.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#Tongue Tiedignature' el
ement is not declared. Line 137, position 8.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#Tongue Tiedignature' el
ement is not declared. Line 178, position 8.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:KeyInfo' elem
ent is not declared. Line 154, position 8.

Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.

Error: Error generating classes for schema 'liberty-metadata-v1_1'.
- The element 'http://www.w3.org/2000/09/xmldsig#:KeyInfo' is missing.

If you would like more help, please type "xsd / ".

I will look forward to any clues.

The schema can be downloaded from:

http://www.projectliberty.org/liberty/resource_center/specifications/liberty_alliance_specifications_support_documents_and_utility_schema_files



Re: XML and the .NET Framework Error generating classes using XSD.exe

Derek Smyth

Hi,

The schema must be digitally signed. The errors that are being reported are to do with XML digital signatures (DSIG) elements. You wouldn't want to create code for these. Maybe if you use the /element switch of the XSD to pick out different elements of the schema. Rather than generate the classes from the schema in one large hit, pull out elements and build your classes one by one.






Re: XML and the .NET Framework Error generating classes using XSD.exe

Subrata

Derek,

Thanks for your response. In any case, I had tried two things in the meantime (between my post and your reposne):

1) Downloaded the referenced schema files in the local directory and passed the names of those in the command line. So my command line looked like:

xsd /c liberty-metadata-v1.1.xsd xenc-schema.xsd xmldsig-core-schema.xsd

That worked and it created all the classed.

But as you mentioned, I did not want to create the code for the DSIG elements.

So, next I tried to use the /e option. I tried the following for the "EntityDescriptor" element (that being one o fthe top level elements in the expected XML), but still got the similar errors as earlier.

>xsd /c /e:EntityDescriptor liberty-metadata-v1.1.xsd /l:cs /n:Test

So, I tried passing in the referenced assemblies in the command line and Bingo... it worked again. But created the the DSIG classes.

Lastly, as xsd.exe does not allow you to specify the name of the output file, all the files created for individulal elements will ne named the same. So I will need an extra step of renaming after every element class generation. That's managable. But, now the elements like "EntityDescriptor" and "EntitiesDescriptor" both will create the DSIG classes and so the project will name compile with duplicate definitions. I surely did not want different namespaces for different elements.

Any thoughts.