XSD schema setup

When setting up a new XSD schema, Mint 2 executes the following steps:

  1. Gets the requested XSD from a path relative to paths.schemas directory defined in mint.properties.
  2. Looks for available configuration in the same directory as of the XSDs, with the same name plus the .conf suffix (If such a file does not exist, it attempts to generate basic configuration properties automatically).
  3. Parses the XSD and generates a mapping template based on the schema configuration file. This template is stored in the jsonOriginal property of the XmlSchema database object.
  4. Parses annotations in the XSD to generate schema documentation, available in the mapping editor. The result is stored in the schema’s documentation property.
  5. If a customization Groovy script is defined in the configuration file (through the customization property), it loads the script and runs it with this mapping template as input. The result is stored in the jsonTemplate property, which is used to create a new mapping. If no script is defined, jsonOriginal is copied in jsonTemplate.

This process is controlled from the Home>Administration>Manage XSDs page, which uses the OutputXSD action and schemasummary.jsp. Already processed schemas appear there with the following control options:

  • Rename schema. Use this to rename the schema entry.
  • Reload for mapping. Use this if the XSD has changed and you want to start the process from the beginning.
  • Reapply configuration. Use this if only the schema configuration or the customization Groovy script have changed and you want to reconfigure the mapping template. It will use the already stored template in jsonOriginal and will take significantly less time since it will not parse the XSD schema. Note that if the item configuration property has changed then you have to use the Reload option because parsing is needed to generate a template for the new item root.
  • View XSD. Shows the filename of the XSD.
  • View schema configuration properties. View configuration properties stored in the database for this schema. These are also used by mappings at all times (even if created before this version of the configuration file was loaded).
  • View original template. View the mapping template generated by the parser, before any customization applied.
  • View customized template. View the customized mapping template that is used to create a new mapping.
  • Edit template. This is an experimental feature to allow editing of the customized jsonTemplate using the mapping editor. Currently it is possible to modify the template, but changes will be lost if you reapply configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *