Inferring an XSD from XML

Many API vendors provide example XML but don’t provide the necessary XSD. Whether you are creating a new Transform (ation) with a target XML structure or editing an existing Transform’s XML target, you can infer the XML’s structure (XSD) with an existing XML file.
This is very handy but has some risk. Because you are inferring a schema, it’s only as good as your sample XML.
In particular, Jitterbit infers the multiplicity of a tag from the number of instances in the sample XML. For example, if a
After clicking the Generate button and the inference was successful, you should Review the Result (Open Folder button) of the generated XSD file before you click the Next> button in the Wizard used.
This way you can examine and edit your source XML and (more) the inferred XSD file by opening either file via the OS File Browser. Look for desired values of minOccurs and maxOccurs in your relevant
The XSD syntax corresponds to the desired Jitterbit E modifier notation in the Transform.
[E] (one and only one) minOccurs=”1″ maxOccurs=”1″
[E+] (one or more) minOccurs=”1″ maxOccurs=”unbounded”
[E?] (zero or one) minOccurs=”0″ maxOccurs=”1″
[E*] (zero or more) minOccurs=”0″ maxOccurs=”unbounded”
Each time you “Generate the XSD”, you can choose the name of the XSD file (you cannot include a path) and it’s now available as a selectable XML structure for other Transforms.
When iterating your desired XSD, it best to copy the file from (in this case, Windows) ..\AppData\Local\Temp\jitterbit_studio\xml2xsd\
One other inference risk that may be of concern is the data type. The following are some supported data types. If this gets confusing, you can always prefer “string” and cast the type within the Jitterbit field mapping.
- string
- boolean
- decimal
- float
- double
- duration
- dateTime
- time
- date
As you can see, all is not lost if you have an XML file and need the XSD for a transformation. Without too much understanding of XSD, you can complete and test your desired XML transformations.
No Comments