Download all files referenced in an xsd locally (+ Possible fix for BizTalk CS0013 compilation error)

By patrickwellink
September 30, 2010
Comments Off on Download all files referenced in an xsd locally (+ Possible fix for BizTalk CS0013 compilation error)

Well if you ever end up like me with a XSD that has about a zillion includes (schemaLocation), maybe this tool is something for you.

It is a pretty simple tool. You give it an XSD, and it will download all files that are referenced to your local system. It will parse the file names a bit and set them all to the local download folder.
This way you can simply include the folders and downloaded schema’s in your BizTalk Project.

For example take the schema’s from UNECE like http://www.unece.org/uncefact/data/standard/Acknowledgement_4p0.xsd

It can be pretty frustrating to download all the schema’s manually and link them together again with a correct import. IncludeSchemaDownloader.exe comes to the rescue.. Below is a screenshot of this tool.

The workings are quite simple. Follow these steps to get the all the schema’s on yoyr local machine.

  1. Download the Toplevel XSD to a work folder.
  2. Point the Toplevel XSD to that working folder.
  3. Point the StoreFolder to the desired location where the xsd’s will be stored (typically schema’s folder of a BizTalk Project
  4. Hit the process button !
  5. Done
  6. Now include this folder in your BizTalk project
  7. Hit the Validate button… (should work)

Now these XSD schemas that you get from UNECE are full with usefull comments and annotations. And if your schema’s get too large you cannot compile them anymore. (there seems to be a limit in the size of the dll the BizTalk compile can handle). You would get an error message like this:

error CS0013: Unexpected error writing metadata to file ‘<somedrive><somefolders><yourproject>.dll’

 

To solve this you would have to break up your huge XSD project into smaller projects. This would solve the problem but in my case VisualStudio was soo busy reflectoring all the DLL’s it hardly had time for me. (You know opening a map would take ages….).

When I looked into the XSD’s they were all beautifully documented with lots and lots of annotations and comments. But wait a minute….. I only had to send these documents. So i only have to validate the documents. So I don’t need all those comments and annotations. That’s why the tool has the option to strip comments and annotations.

When I tried to compile the XSD’s with comments and annotations (size on disk roughly 12 megabytes) I got the dreaded  CS0013 compilation error.

I ran the tool again (size on dis now about 1.5 megabytes) I ended up with a DLL only 4 MB in size. And if reference this DLL in a map or whatever it’s way faster than the other solution(you know several projects / dll’s)

You can download the tool >>HERE <<

If I import the schema http://www.unece.org/uncefact/data/standard/Acknowledgement_4p0.xsd

The output of the tool will be  :

Starting with D:TempDemoAcknowledgement_4p0.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/data/standard/UnqualifiedDataType_7p0.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/IANA_CharacterSetCode_20070514.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/IANA_MIMEMediaType_20090304.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/identifierlist/standard/ISO_ISOTwoletterCountryCode_SecondEdition2006VI-4.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/ISO_ISO3AlphaCurrencyCode_20090305.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_CharacterSetEncodingCode_40106.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_MeasurementUnitCommonCode_5.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_AgencyIdentificationCode_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/data/standard/QualifiedDataType_6p0.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/data/standard/UnqualifiedDataType_7p0.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/IANA_CharacterSetCode_20070514.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/IANA_MIMEMediaType_20090304.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/identifierlist/standard/ISO_ISOTwoletterCountryCode_SecondEdition2006VI-4.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/ISO_ISO3AlphaCurrencyCode_20090305.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_CharacterSetEncodingCode_40106.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_MeasurementUnitCommonCode_5.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/UNECE_AgencyIdentificationCode_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingAccountType_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingAmountType_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingEntryCategory_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingEntryLineCategory_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingEntryLineSource_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingEntryProcessing_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AccountingVoucherMedium_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_AlternateCurrencyAmount_D08B.xsd
getting all imports
Loading file :http://www.unece.org/uncefact/codelist/standard/EDIFICASEU_TaxExemptionReason_D08B.xsd
This list goes on and on and on

 Below are some results:

 

 

 

 

Comments: 0

Comments are closed.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta