# XMLSchema linking

Colorer library package contains scripts and settings, which allows you to integrate it with XML language editing process and add to Colorer features of an on-fly XML validation. Colorer package includes XSLT Scripts for producing transformations of XML Schemas 1.0 into the HRC language. Resulted HRC files could be used by Colorer and provide syntax checking and document's logical structure validation.

## Including support

Colorer includes following XML languages and their schemas:

- XHTML 1.0 (Strict, Transitional)
- XSLT 1.0, XSLFO 1.0
- XMLSchema 1.0
- OASIS DocBook 4.1
- Relax NG 1.0
- WSC, WSF
- Sun's web.xml

To add others language support, you must use those language's XSD description and transform it through the xsd2hrc.xsl transformation. Colorer package includes DTD to XMLSchema converter (`xsd2hrc/schemas/dtd/dtd2xsd/dtd2xsd.pl`), so you can use DTD descriptions also.

## xsd2hrc.xsl

This transformation (`/bin/xsd2hrc/xsd2hrc.xsl`) generates HRC syntax files to parse XML files from appropriate XML Schema description of these files type. Generated HRC syntax conforms XML Schema Recomendations, except some syntax and logic looses. Most of them can't be implemented due to HRC context-free grammar model limitations.

## Limitations

- Poor namespace checks. It is assumed, that some set of frequently used ns prefixes (including empty and any prefixes) is provided for each namespace. This set can be easily changed.
- Elements order check looses. Ignoring difference in `xs:sequence, xs:choose, xs:all`, treating any of them as `<xs:choose minOccurs="0" maxOccurs="unbounded">`
- `xs:list/xs:union` membertypes order has no importance in xmlschema, but can greatly affect syntax results in HRC.
- Limited `xs:import` support. Using it implies, that there is an already defined HRC type for imported schema, and importing schema just refers it with the valid hrc type prefix, obtained from HRC catalog file using the @targetNamespace attribute of the prototype definition element.
- Ignoring difference in `xs:union`, `xs:list`.
- `xs:simpleType/xs:restriction` is just reference to base type except then using `xs:enumeration` and `xs:pattern` facets.
- Lax buildin simpleTypes support. Treating all of them as lists.
- Unsupported substitution groups, `xsi:type` instance element identification.
- Missed keys and unique constrains checks.
- No `xs:redefine` support.

## TODO:

- 'fixed' on attr decls
- xs:redefine features
- substitution groups??
- different hrc regions assign for different xml elements?
- additional special region indention