Completion
----------

After completing start-tag, ensure we don't get unhelpful message
from validation

Syntax table for completion.

Should complete start-tag name with a space if namespace attributes
are required.

When completing start-tag name with no prefix and it doesn't match
should try to infer namespace from local name.

Should completion pay attention to characters after point?  If so,
how?

When completing start-tag name, add required atts if only one required
attribute.

When completing attribute name, add attribute value if only one value
is possible.

After attribute-value completion, insert space after close delimiter
if more attributes are required.

Complete on enumerated data values in elements.

When in context that allows only elements, should get tag
completion without having to type < first.

When completing attributes, more consistent to ignore all attributes
after point.

Inserting attribute value completions needs to be sensitive to what
delimiter is used so that it quotes the correct character.

Schema-sensitive features
-------------------------

Complete namespace declarations by searching for all namespaces
mentioned in the schema.

Take advantage of a:documentation.

Provide feasible validation toggle.

Save the validation state as a property on the error overlay to enable
more detailed diagnosis.

Provide an Error Summary buffer showing all the validation errors.

Allow schema to be associated with document using processing
instruction in prolog that contains URI of schema.  There should be a
customizable alist of target names + regexp to parse the processing
instruction content + group number for the URI.

Allow processing instruction in prolog to contain the compact syntax
schema directly.  There should be a customizable variable of type list
of strings specifying the target names of processing instructions that
have this semantic.

Allow schema to be associated with document using DTD public ID.  Or
perhaps use a catalog and a processing instruction in a custom version
of the DTD.

Command to insert an element template, including all required
attributes and child elements.

Command to tag a region.

Schema-sensitive paragraph filling (intelligently using content models
to distinguish block and inline elements).

Pop-up menu.  What is useful?  Tag a region (should be greyed out if
the region is not balanced).  Suggestions based on error messages.

Use RDDL to locate a schema based on the namespace URI.

Have configurable list of namespace URIs so that we can provide
namespace URI completion on extension elements or with schema-less
documents.

Easier way to register a schema.  Maybe after C-c C-s provide
opportunity to persisently associate with namespace URI and extension.

Allow validation to handle XInclude.

Well-formed XML support
-----------------------

Add a function to write-contents-hooks to ensure encoding declaration
is consistent with encoding actually used to save buffer.

Complete entity names.

Support for declaring character entities.  Allow user to specify a
list of files containing entity declarations, which automatically get
added to internal subset when used. Provide command to optimize
declared character entities, sorting and removing unused declarations.

Command to repeat the last tag.

Paragraph filling. auto-fill support.

Paragraph in general.

Set up emacs coding system to use XML encoding declaration.

Support for changing between character references and characters.
Need to check that context is one in which character references are
allowed.  xmltok prolog parsing will need to distinguish parameter
literals from other kinds of literal.

Comment support.

Structure view.

Flash matching >.

Collapse and expand elements (using invisible, intangible and display
text properties).

Smart selection command that selects increasingly large syntactically
coherent chunks of XML.  If point is in an attribute value, first
select complete value; then if command is repeated, select value plus
delimiters, then select attribute name as well, then complete
start-tag, then complete element, then enclosing element, etc.

ispell integration.

Datatypes
---------

Figure out workaround for CJK characters with regexps.

Does category C contain Cn?

Do ENTITY datatype properly.

Handling all XML features
-------------------------

Handle internal general entity declarations containing elements.

Handle external general entity declarations.

Handle default attribute declarations in internal subset.

Handle parameter entities (including DTD).

RELAX NG conformance
--------------------

Do complete schema checking, at least optionally.

Detect include/external loops during schema parse.

Catching XML errors
-------------------

Check public identifiers.

Check default attribute values.

Performance
-----------

Cache after first tag.

Introduce a new name class that is a choice between names (so that
we can use member)

intern-choice should simplify after patterns with same 1st/2nd args

Error recovery
--------------

Don't stop at newline in looking for close of start-tag.

Use indentation to guide recovery from mismatched end-tags

Don't keep parsing when currently not well-formed but previously
well-formed

Try to recover from a bad start-tag by popping an open element if
there was a mismatched end-tag unaccounted for.

Try to recover from a bad start-tag open on the hypothesis that there
was an error in the namespace URI.

Better recovery from ill-formed XML declarations.

Useability improvements
-----------------------

Should print a "Parsing..." message during long movements.

Provide better position for reference to undefined pattern error.

Put Well-formed in the mode-line when validating against any-content.

Trim marking of illegal data for whitespace.

Show Invalid status as soon as we are sure it's invalid, rather than
waiting for everything to be completely up to date.

When narrowed, Valid or Invalid status should probably consider only
validity of narrowed region.

Bug fixes
---------

Should delete *RNC Input* buffers.

Figure out what regex use for NCName and use it consistently,

Should have not-well-formed tokens in ref.

Require version in XML declaration? Probably not because prevents
use for external parsed entities. At least forbid standalone
without version.

Reject schema that compiles to rng-not-allowed-ipattern.

Move point backwards on schema parse error so that it's on the right token.

Internal
--------

xmltok should make available replacement text of entities containing
elements

Avoid having rng-valid depend on rng-cmpct.  Introduce a
rng-schema-loader-alist variable mapping filenames to schema loader
functions.

Port to XEmacs.

Fontification
-------------

Allow fontification to be data-type sensitive.


Notes
-----

How can we allow an error to be displayed on a different token from
where it is detected?  In particular, for a missing closing ">" we
will need to display it at the beginning of the following token.  At
the moment, when we parse the following token the error overlay will
get cleared.

How should rng-goto-next-error deal with narrowing?

Perhaps should merge errors having same start position even if they
have different ends.

Should rng-validate-mode give the user an opportunity to specify a
schema if there is currently none? Or should it at least give a hint
to the user how to specify a non-vacuous schema?

How to handle surrogates? One possibility is to be compatible with
utf8.e: represent as sequence of 4 chars.  But utf-16 is incompatible
with this.

Should we distinguish well-formedness errors from invalidity errors?
(I think not: we may want to recover from a bad start-tag by implying
an end-tag.)
