Westie / AmazonMarketplaceXSD

4 stars 6 forks source link

.NET xsd generator "EncryptedData element is not declared" error #1

Open Ali-ModernBeauty opened 4 years ago

Ali-ModernBeauty commented 4 years ago

Hey! Firstly, THANK YOU! It was a nightmare trying to get all XSD files together let alone finding the latest version of each file.

So, wondering if you can help me out with this. I'm trying to generate C# classes from the XSD files you provided. For some reason, it's not seeing that the W3 schemas are included. I'm no expert in XSD and have never worked with it before until now because I have integrated with ancient technology before.

http://www.w3.org/2001/04/xmlenc#:EncryptedData is referenced in OrderReport.xsd, specifically, AmazonW3CEncryptedType element. If I remove OrderReport from amzn-envelope.xsd, it generates successfully.

Here is the whole thing for reference.

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools>xsd Z:\Projects\MWS\MWS\MWS\XSD\amzn-envelope.xsd  /c /o:Z:\Projects\MWS\MWS\Models2\
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.7.2558.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2001/04/xmlenc#:EncryptedData' element is not declared. Line 463, position 14.

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

Error: Error generating classes for schema 'Z:\Projects\MWS\MWS\MWS\XSD\amzn-envelope'.
  - The element 'http://www.w3.org/2001/04/xmlenc#:EncryptedData' is missing.

If you would like more help, please type "xsd /?".
Westie commented 4 years ago

I'm no expert in XSD and have never worked with it before until now because I have integrated with ancient technology before

I wouldn't call XSD modern!

Try adding https://www.w3.org/TR/xmlenc-core/xenc-schema.xsd to the folder with the rest of the XSDs - can't test it at the moment but I believe this will resolve your issue

Ali-ModernBeauty commented 4 years ago

I have never integrated with ancient technology before.

Agreed. XSD was being used before I even learned to read.

I believe you already have that file in there. There were no missing files, just that odd compile error.

Thinking out loud, it could be how it's getting imported like any version/doctype mismatch. The two w3 files (xenc-schema.xsd, xmldsig-core-schema.xsd) are under another schema too. I'm not sure of anything I'm saying, just brainstorming.