2

I try to generate classes from the following SAML2.0 XSD schemas:

  1. http://docs.oasis-open.org/wsfed/authorization/v1.2/authorization.xsd - fail
  2. http://docs.oasis-open.org/wsfed/federation/v1.2/federation.xsd - fail
  3. http://docs.oasis-open.org/wsfed/privacy/v1.2/privacy.xsd - success

I tried to use xsd.exe and xsd2code tools, but each time I try to generate #1 and #2 I get following errors for the respective schemas:

  1. Both tools throw this error: Schema validation warning: The 'http://www.w3.org/2001/04/xmlenc#:EncryptedData' element is not declared. Error: Error generating classes for schema '%MYPATH%\authorization'. The element 'http://www.w3.org/2001/04/xmlenc#:EncryptedData' is missing.
  2. Two different errors:

To solve problems related to xmlenc namespace I saved remote xenc-schema.xsd to my local path, but I still get the same error, so it's not timeout problem.

I don't understand what could be the problem with the provided schemas. How to solve all of the mentioned problems?

desperate man
  • 905
  • 1
  • 17
  • 39

2 Answers2

0

There seems to be an issue with DOCTYPE being declared in the XSD for xmlenc (http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd). See; You'll need to download and edit the included XSD file(s), or perhaps apply a fix as described in https://xsd2code.codeplex.com/workitem/6972 (XmlReaderSettings.ProhibitDtd = false) would work. See here as well: Xsd2Code and xmldsig

Community
  • 1
  • 1
Hans Z.
  • 50,496
  • 12
  • 102
  • 115
0

I just had a same error when I tried to validate the XML schema of a SAML response. I managed to solve it by saving all .xsd files locally, then manually removing the DTD and the import elements from them, and loading all of them manually.

György Balássy
  • 2,938
  • 1
  • 28
  • 23