Automatic template creation from XML or XSD

You probably know about the nice XLS, HL7... parsing possibilities of Saddle. Then, you know it's based on templates to define the structure of the expected data. But you also know that for huge structures, it may take some time to create the template. That's why we created the Rapid Prototyper, and the good news is that now, you can create templates from directly XML and XSD!

 

XML Prototyping

To create a template from a XML file, first create a new template. Then, simply copy/paste your sample file (or load one) in the Sample message window. In the Rapid Prototyper window, you'll notice the dropdown list to switch automatically to XML Prototyper.

Click on the arrow button on the bottom right to start the parsing.

pasteForXML2

And that's it, Saddle will suggest a template matching your sample file. It will even detect data types and repeating groups!

resultXMLprototyper2

You can of course review and refine the template, and test it using the Test Sample window.

xmlTestTemplate

The result is displayed in the tree structure:

resultOfXMLTransformation

XSD Prototyping

For XSD files, the idea is the same. If you have a XSD file, copy/paste or load it into the sample message window. The prototyper dropdown list will switch to XSD prototyper.

If you need more than one file (for example a root XSD file and imports or dependencies), use the XSD Folder button to browse to the folder containing all required schemas.

xsdPrototyper

For XSD, you also need to specify the name of the root node of your schema (i.e. the one from which all other elements are children). If your schema makes use of namespaces, write the namespace of the root node. Whenever possible, Saddle will try to auto-detect this for you!

And again, click on the arrow button, and a corresponding template will be created.

What about substitution groups ?

If your schema uses substitution groups, Saddle will normally detect it. If not, or if you're building a template by yourself, this is how it works:

  • Create a group, checking the attribute "OR-group", that will contain all the possible names
  • In the property "Substitution names" of the group, write the possible names that this group could have

For example, if your schema has an element <customer> with a child <name> having substitution <nom> and <navn>, it will look like this:

subs1

subs2

What about namespaces ?

Saddle will do its best to auto-detect namespaces in your schemas.

Each node of your template has a "Namespace" attribute. Put the namespace (as URL) here.

On the root node (the one having the name of the template), you have 3 new attributes:

  • "Prefixes" where you make the association between a prefix and its namespace (format: ns1=http://test.com,ns2=http://test2.com)
  • "Base namespace" where you write the namespace URL that should not be bound to any prefix
  • "Schema Location" where you define what you want to write as Schame Location in case you output the file

ns

In this way, you can change the prefixes directly and only on the root node!

 

We hope that you'll like these cool new features! Don't hesitate to share you thoughts about it!

Add comment

Security code
Refresh