Avoid making all element declarations global.

We can get (x | (y | z)) if (y|z) was a name class.  Simplify into x|y|z.

Check for duplicate attributes.

Check for violations of RELAX NG interleave restriction.

Approximation warnings:
- interleave
- mixed text
- list containing a group of two non-empty tokens
- element wildcard with content that does not allow everything
- wildcards with two or more negative namespaces
- wildcards with negative single names
- choice between attributes
- choice between elements and data

Provide annotation to control which target namespace is assigned to a file.

Take advantage of minOccurs > 1 and 1 < maxOccurs < infinity.

If expansion of a group causes the group to become unreferenced, then remove the group.

If define referenced only in something that is unreachable because of notAllowed, remove the define.

Use complexTypes for groups and simpleTypes with associated attributes, even if not all references can
make use of them.

Use the last component of the namespace URI in selecting prefix and generated schema file when no prefix is used in the
RELAX NG.

Try using default namespace declaration to refer to things in targetNamespace.

Make choice of targetNamespace not depend on order of hash table iteration.

Handle nested grammars (use different namespace for different grammars).

Turn overrides into <redefine>.

Preserve definitions that are equivalent to empty or notAllowed.
A define whose pattern is equivalent to notAllowed should be preserved
in the intermediate form, since it may correspond to the abstract head
of a substitution group (probably need an annotation to control this).

Handle externalRef (remember problem with parentRef in externalRef)

Interleave
- Avoid introducing ambiguities when approximating <interleave>, eg x & (y, y).
- Optimize nested choices in expanding <interleave>.
- Optimize eg x* & (a, b, c) into x*, (a, x*), (b, x*), (c, x*)

For a <value type="NOTATION"/>, map to NOTATION and generate an
appropriate xs:notation declaration based on annotations.

Deal with xsi attributes.

Better support for combine="choice".  Now that element substitution groups
are supported, combine="choice" can be supported much better.
Intermediate form needs support for combine="choice".  If a
combine="choice" turns out to be substitution group, then there's no
problem.  Otherwise we can distinguish three cases:

- same file: choose one to be the main definition; for the others two
strategies: (a) move into the main (b) modify the name and add
reference to it to the main definition

- same file, different target namespace: preserve separate
definitions; either generate new definition in different namespace to
combine them or choose on of the target namespaces to be the main one

- same file, same target namespace: files are related by include; try
to use redefine; can combine two definitions from include parent and
include descendant, not two definitions from two include children; in
this case, rename defines in childen and add define to parent.

Deal with annotations (provide special support for xs:key/xs:keyRef/xs:unique).

Better support for xsd:documentation:
- copy xsd:documentation annotations
- copy xml:lang attribute from a:documentation elements
- allow multiple a:documentation elements

Be more careful about preserving annotations.

Deal with element type consistent restriction

Deal with ambiguous content model restriction

Avoid redundant imports and redundant namespace declarations.

With combine attributes, maybe insert <ref> to preserve file structure.

Deal with repeated inclusions of same file, by expanding.

Add an annotation on elements to convey <start> info.

Handle the case where the head of a substitution group should be a non-abstract element
(remember to deal with type derivation restriction).

Deal with non top-level commments.

Annotations to control block and final attributes.

Consider turning attribute groups (without paired group or simple type) into complex type.

Map element with <text/> only content onto element with simple type of string
(or at least provide option for this).

Option to strip prefix or suffix (e.g. suffix ".att") so as to take advantage of XSD's multiple namespaces.


