Nexaweb provides an XML schema for both UI files and XML-stylesheet files. The schema files are located in the Nexaweb Platform/ schema directory. This feature is turned off by default because of the added file size incurred by adding the schema support. To turn this on go to "Window -> Preference" menu then click on the "Nexaweb -> Source Editors" Preference Page, then check the "Include Schema Tag" check box.
Example schema support in an XAL document:
<xal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:/Program%20Files/Nexaweb%20Platform%204.0/schema/nexawebxmlfull.xsd">
</xal>
The noNamespaceSchema attribute is used because the UI components are not namespaced and this attribute tells the validator to use the supplied schema for all non-namespaced components.
In Nexaweb 4.5 XAL files can have multiple components with different namespaces embedded into a single file to validate all namespaces the user needs to add the following attribute to validate the multiple namespaces in a single file.
<xal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nexaweb.com/mco file:/Program%20Files/Nexaweb%20Platform%204.0/schema/mco.xsd http://openxal.org/core/xmodify file:/Program%20Files/Nexaweb%20Platform%204.0/schema/xmodify.xsd">
</xal>
In the code snippet above the schemaLocation attribute contains a list of space delimited namespace / schema location pairs. Notice in the code snippet the namespace http://nexaweb.com/mco followed by it's schema file then another spaced followed by the XUpdate namespace and its schema file. If more namespaced were needed this pattern would continue.
To validate the XAL document against the schema, select the "Validate Document" toolbar button
or menu item. If the document contains validation error it will be marked in the red.
Figure 104 Schema Validation in XML Editor
Figure 104 - shows the source editor after performing a schema validation. Moving your mouse over the red square on the right will provide information about the validation error. In the example the window does not support the text attribute.
Remove the text attribute and hit the space key to activate the content assistance feature of the XML Editor. Figure 105 - displays a drop down menu of all the attributes that begin the "ti", selecting the "title" line will automatically complete the attribute in the source editor.
Figure 105 Content assistance
Note: The Nexaweb client does not support extending the schema. This schema is to be used for validation during development.