Skip to content

Flow documentation · legacy product

XSD Inference ​

Microsoft XSD Inference is a command line tool you can use to infer a XSD Schema from an instance of XML. The more different instances you pass to the tool the better able it is to infer the schema accurately.

The tool is installed alongside Flow to the Program Directory.

Using the tool ​

  1. Copy the XML instance that you want to infer a schema from into the C:\ drive.
  2. Open CMD prompt and go to C:\program files\flow software
  3. Type "infer myfile.xml -o myschema.xsd" to infer a schema from myfile.xml
  4. Copy the schemas created (myschema_1.xsd, myschema_2.xsd, etc) into the flow schema folder

TIP

For more information on the infer.exe parameters type "infer /?" at the command line

Correcting the XSD Schema ​

Generally you will need to make manual adjustments to any schema generated using the tool, in particular in the case of the data types assigned to fields. If a field in your instance of XML has the value 123 it will be inferred as a numeric datatype, however a different instance of the file could have ABC in this field meaning it should have been inferred as a string type. It is also possible your instance of XML does not include a field therefore it will not be present in the schema either.

You may also need to add an import directive to the first schema if the tool generates 2 or more schema files. This will occur if there are multiple namespaces in the XML instance.

xml
<xs:import schemaLocation="myschema_2.xsd" namespace="http://tempuri" />