
Schema validation
This page was automatically translated. Stay tuned for a human translation…
A special feature of the speedata Publisher is that the input language is formulated in XML. Compared to other programming languages, XML is "chatty": You always have to write end tags for the start tags:
<PlaceObject>
...
</PlaceObject>
Compared to a C-like syntax like
placeObject(...)
this is more typing. The solution to this "problem" is to use a text editor that is good with XML. For example, entering a start tag would immediately insert the end tag. Or, if the tag name was changed, both the start tag and the end tag would be changed at the same time. Good XML editors do much more than just make it easier to enter tags, for example, to validate code against a schema.
What is a schema?
A schema (e.g. XML-Schema orhttps://de.wikipedia.org/wiki/RELAX_NG[RELAX NG]) contains information about the permitted structure of an XML file. For example, the schema that is supplied with the speedata Publisher contains the following
-
The root element must be called
<Layout>
-
The child element of
<PlaceObject>
must be either<Barcode>
,<Box>
,<Circle>
,<Frame>
,<Image>
,<Rule>
,<Table>
,<Textblock>
or<Transformation>
. - The attribute valign in the table row can be one of the values top, middle, or bottom
- and many more
The documentation of the individual commands and the selection options is also included in the supplied schematic. A good XML editor can import such a schema and make it much easier for the user to enter the source code. The input with a good schema is a lot of fun and has some advantages over the classic text editor:
- Syntax errors are displayed immediately
- Commands (tags) do not have to be entered completely, because the editor offers an auto-complete function
- The attributes are immediately checked for meaningful values
- Documentation is available directly in the editor
... basically what you expect from an integrated development environment (IDE).


Integration of the RELAX NG schema
How the schema is included depends on the editor. For oXygen XML, for example, you can create a new document type assignment in the settings. You have to define for which namespace the schema should be used.

Then you have to define which schema should be loaded for these link rules. This is defined in the second tab of the setting.

From now on, for every layout in the namespace
xmlns="urn:speedata.de:2009/publisher/en"
the schema should be associated. This can be recognized by the fact that a selection of commands now appears when you enter an opening angle bracket (<).
