XML to XSD (to structure)
It is possible to automatically create an XML source structure in a profile. To do this, you need a schema file (XSD or DTD) of the XML file that is later to be read into this source structure.
Since such a schema file is not always available, but usually one or more example XML input files, we provide this plug-in to create an XSD file from an XML file.
Below you will also find a way to create a structure directly from an XML file.
Settings
(1) Settings for XSD creation: If option "Use reference resolution" is selected, only one definition entry is created for same-named XML nodes. This entry is then referenced. If two nodes have the same name but a different structure, only the first node is defined and then used for both nodes. If no references are used, a definition entry is created for all nodes. Obviously, this increases the size of the definition file, but nodes of the same name can have different structures.
If option "XML has simple fields only" is enabled, any XML element that does not have sub-elements or attributes is created as a simple field in the source structure (if the XSD file created here is used to create the source structure). Otherwise, such an XML element would be represented in the source structure as a node containing a field named <nodename>_val to represent the value of the XML element. See also section Match codes, unique/reserved names for XML.
(2) XML - Drag 'n Drop file: The XML file can be uploaded here via drag and drop or via the "Import" button. Note: The plugin expects that the XML file specifies the encoding like this: <?xml version="1.0" encoding="ISO-8859-1"?>. The XML file actually must be encoded with this encoding, otherwise, an error will occur. If no encoding is specified in the XML file, the plugin assumes by default that the XML file is encoded with UTF-8. Also, in this case, the XML file must be encoded with UTF-8, otherwise an error will occur.
Important note: A complete schema file (as the name implies) usually covers all possible XML files. However, if you are using only one XML sample file, you usually cover only a part of all possible variations of the XML files. Therefore, to create the XSD file, you should use an XML file that contains a maximum of possible elements/substructures. If such a file is not available, but multiple XML files that cover different elements/substructures, you can also consolidate a single XML file from multiple XML files in a text editor and then use this file to create the XSD file. If in the course of time, additional XML input files appear that cannot be read into the automatically created XML source structure, the input structure must be adjusted manually. It may also be necessary to adjust the "Min/Max" values of some nodes or fields.
Use XSD file for structure generation
See sections "Import structure" and "Analyse file for structure".
Creating structure directly from XML file
If you do not want to take the manual detour via an XSD file, you can also generate a structure directly from an XML file. In this case, the XSD file is created in an internal intermediate step and the structure is then generated from it. See section "Analyse file for structure".