Problems with Entities (was re:Embed and validation)

Rob McDougall RMcDouga at JetForm.com
Wed Dec 3 19:48:06 GMT 1997


I'm seeing some disturbing similarities between Peter's problem and
mine.  It reflects a general problem that I've seen in many other
languages.  There seems to be two schools of thought about where
declarations should go:

(1) Declarations must be performed near the top of the file.
(2) Declarations should be performed near where they are used.

Method (1) works well for declarations that are going to be referenced
many times throughout the file, and is able to accommodate the cases
where a reference only occurs once.  Method (2) works well for
declarations that are only referenced once, but works rather poorly for
ones that are referenced many times throughout the file.

Which school is right?  I think the trend is to allow either.  Take for
example C vs C++.  C required you to define all your variables at the
top of a function, but C++ also allows you to define them just before
you use them.  I don't think anyone would argue that the additional
flexibility is a bad thing.

Method (1) requires that the user be able to establish "order" in the
file (i.e. make sure the declarations occur at the top).  This greatly
hinders creating files with declarations in them "on the fly".  In order
to know what declarations will be used, the user must perform a first
pass on the data before writing it out.  This is not always possible and
is seldom desirable.

I realise this inflexibility is something that has been inherited from
SGML, but I worry that this will impede XML's adoption into the
marketplace.  This is the second time I've had to reject using XML's
entity substitution capabilities because of the need to declare all your
entities at the top of the file.  I originally had wished to use the
entity substitution as a text substitution, but unfortunately, my users
will want to "re-define" the value of an entity several times throughout
the file.  This cannot be done using XML entities.

The entity substitution capabilities within XML seem to get me 50% of
the way to where I want to be on a couple of different issues (file
inclusion and text substitution), but unfortunately, I've had to choose
alternative solutions because they don't get me 100% of the way. :(

Rob












xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list