Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Enterprise Architect provides validation of xml documents. Documents can be verified against XML schema or Data Type Definitions (DTD). Validation is performed from within an Enterprise Architect editor using its context menu. Often an xml document will contain information relating to the schema that it conforms to. You can however choose to override this, validating the document against any schema, either at a path on your local machine or at a URL. This example demonstrates the use of the feature for a document that contains an incorrect attribute.
Accessible from context menu of any editor window displaying xml content.
Right-click in editor window and choose 'XML Validation'
XML Document Validation
Open the XML document to be validated.
Use the editor context menu and select the 'XML Validation' option.
Select the grammar of choice from the available options:
Select the schema location. 'Defined in document' is selected by default. It is usual for an xml document to specify the schemas that governs its content. To choose a different schema from that defined in the document, select 'External' and provide either a URL or file path. Examples:
Click OK. The output of the validation will be displayed in the 'XML Validation' tab of the System Output window.
XML Document Validation Example
Figure 1: The XML document with an invalid attribute value 'nyss'
In this example, the document describes a stock item that has an invalid exchange code 'nyss'. As can be seen from this schema, the only valid values for the 'exchange' attribute are 'nyse', 'nasdaq' or 'ftsi'.
Figure 2: The XML Schema describing permitted stock exchange codes
This image shows the schema used in the validation. The declaration of a 'portfolio' element can be seen here to be made up of one or more 'stock' elements. Each stock element in turn, requires an 'exchange' attribute naming a code for the stock exchange in question.
Figure 3: The 'XML validation' dialog naming a local schema file
This is the 'XML Validation' dialog. It is accessible from the context menu of any editor in Enterprise Architect that holds XML content. Here you can select the schema to use in the validation. In the example the processor will validate the document using a local schema file. This just happens to be the same schema named by the document, but it could be any schema (a development or later version of the schema for example).
Figure 4: The System Output window showing validation error
This image shows the results of the validation. The attribute value 'nyss' has been identified as being incorrect according to the enumeration described by the schema. Double-clicking the error will display the line of code in the editor where it can easily be corrected.