Generating code from XSDs

Introduction

In order to effectively use the .xsd files, that are available under the Integration Schema Files section, you will need to generate the code based on the following info.

There may be a variety of tools to generate code from our XSDs, depending on which language you use and also on your personal preference between tools.

Whichever tool you work with, the following steps should allow you to generate code:

  1. Copy all the XSD files from Confluence to a new folder on your machine.
  2. Pass all XSD files into your generate command.

During step 2, it is best to avoid using commands of the following format: ”generate-code schemas.sportsdataservices.com.integrationservice.v3.xsd”

Instead, the following should be used: ”generate-code *.xsd”

Using *.xsd will pass all of the files from that folder into the command. It is also possible to list the names of all XSDs, however there are a lot of them, so *.xsd is far easier provided no other XSDs are in that folder.

FAQ

Why does your namespace URI return an error when I try to access it in a web browser?

Namespace URIs are not supposed to be pinged, accessed, retrieved etc. All the content required within those namespaces can be found in the other XSD files we have provided.

What tool can I use to generate code?

  • .NET: svcutil.exe or xsd.exe
    • Note that xsd.exe does not support the *.xsd syntax recommended above. If using xsd.exe, you need to list each individual file by name, which is why svcutil may be the preferred tool for this.
  • Java: JAXB or SAX Parser

For Java

The code can be generated using the standard XJC tool with the following command (Files attached).


xjc -d src schemas.sportsdataservices.com.integrationService.v3.xsd -b binding.xml -catalog catalog.xml

With a catalog you should be able to disambiguate references.