Skip to main content

Configure middleware

Before we can start the editor for the first time, it is important to configure the middleware correctly. In this chapter we will only go into rudimentary detail about the middleware. More information about the configuration and hosting can be found in other chapters.

The xemiddleware.config.mjs file is used to configure the middleware. In our project this file is already included and filled with most of the relevant information.

In order to be able to use the middleware, we still need to configure our schema.

For this we open the xemiddleware.config.mjs and go to the item schema. Here we enter our schema, which we added to our project in the second chapter. This should be found under WEB-INF/xsd. It is also important that we resolve all references of the schema under the item map. The key of this object must always be the name of the include, and the value should be the relative path to the file.

export const configuration = mw.defineConfiguration({
//...
schema: {
'default': 'schema@0.0',
'schema@0.0': {
// TODO: Here the own XSD must be used. This should be the same file with which the types were previously generated.
file: './WEB-INF/xsd/content.xsd',

// TODO: All includes/imports in the XSD files must be listed here:
map: {
'mathml/mathml3.xsd': './WEB-INF/xsd/mathml3/mathml3.xsd',
'mathml3-common.xsd': './WEB-INF/xsd/mathml3/mathml3-common.xsd',
'mathml3-content.xsd': './WEB-INF/xsd/mathml3/mathml3-content.xsd',
'mathml3-presentation.xsd': './WEB-INF/xsd/mathml3/mathml3-presentation.xsd',
'mathml3-strict-content.xsd': './WEB-INF/xsd/mathml3/mathml3-strict-content.xsd'
},

transformation: {
xmlToHtml: "./WEB-INF/xsl/xml_to_html_override.xsl",
htmlToXml: "./WEB-INF/xsl/html_to_xml_override.xsl",
officeToHtml: [
"./WEB-INF/xsl/office_to_html_1.xsl",
"./WEB-INF/xsl/office_to_html_2.xsl"
]
}
},
}
//...
});