Overview
Style Tester Of Interfaces (XML) - or Stoix for short - is an XML style checking tool, intended to ensure that XML schema documents (XSD or WSDL Type definitions) conform to a set of predefined coding standards and design guidelines. It is not intended to: confirm XML is valid, that XSDs conform to the W3C XSD schema, or that WSDL documents are valid or WS-I compliant. These areas are already well served by existing tools. Rather this tool is intended to ensure that XML interface specifications meet coding standards e.g. naming conventions for types and elements and standards on structure. In this way the tool performs a similar function to in-editor warnings for languages such as Java/C#.The tool is an XSL document meaning that XSD/WSDL files can be checked by merely transforming them (either in editor
or as a quality control check before accepting a new interface with a tool such as
Kernow. The result of this transformation is an error report which can either be discarded or checked into a release
note as part of a QC procedure if the tool is used as part of a formalised sign-off.
Usage
- Configure settings (variables) in the stylesheet. These are constant variables at the top of the sheet and should be the only changes required for normal usage. This only needs to happen during the initial configuration - further details are given below
- Develop the XSD/WSDL document (click to see example)
- Transform using the XSL tool
- Review error report (click to see example)
Features
Currently the tool can performs the following checks (each check can be enabled/disabled as required):- Naming conventions (Elements, Complex types and simple types) - regular expressions to check names against naming conventions
- Value naming conventions - regular expression to check enumerated values conform to naming conventions
- Presence of min/max occurs attributes - to check all elements have an explicit minOccurs and/or maxOccurs defined
- Implicit definition (complex types) - to check all complex types are explicitly defined outside an element definition
- Implicit definition (simple types) - to check all simple types are explicitly defined outside an element definition
- Elements and types of the same name - to ensure element instances of types do not have the same name as the type they instantiate
- Lack of namespaces - to ensure all documents are namespace aware
- Use of namespaces - if a system is not namespace aware, ensure XSD/WSDL does not use namespaces
- Use of xsd:import - if importing from other XSD documents is not desirable
- Use of xsd:include - if including other XSD documents is not desirable
- Annotation of Element, ComplexType or SimpleType - ensure all elements, complex and/or simple types contain an xsd:annotation
- ERROR: The highest level, produces a node of type error in the output xml report - must be corrected
- WARN: A warning in the xml report - may be ignored but at least the user has been informed
- IGNORE: Checks which may be used by some users or in certain circumstances but have not been turned on in this case. Ignore also allows the inclusion in the tool of contradictory tests e.g. "use of namespaces" and "lack of namespace". If neither of these are set to ignore all documents would return an error!
Download
The XSL is available to freely download from the link below, with ABSOLUTELY NO WARRENTY. This tool is released under the GNU General Public License version 3 (GPLv3), please review the license before making any changes.
If you develop, or think of any additional features which are currently missing please let me know and I'll add useful ones to the tool in later versions. Additionally if you're just using it please let me know, it would be nice to get a feel for how it's being used on the ground.
Future plans
I'll be adding to the unit tests as I go along, and I've already identified some areas which would be handy to have tests for:
- use of unconstrained xsd:types (e.g. xsd:string) in elements
- elements defined as xsd:string
- element with name including the word "date" of type xsd:string
- maxOccurs before minOccurs
- naming convention of namespaces
- use of xsd:any