Entities Was: RE: [xsl] use cases for d-o-e

Subject: Entities Was: RE: [xsl] use cases for d-o-e
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Fri, 11 Jan 2002 17:03:10 +0100
"Bryan Rasmussen" <bry@xxxxxxxxxx> wrote:
> anyway
> in situations like this it might be useful to output entities into the
> document, because the document is one that will be edited further down the
> line by a human.

Do you expect them to use generic text editors?
I was under the impression that XML editors and related tools
have been evolved to a stage where entities are no longer a
significant advantage.
But i may be biased, my editing environment (Emacs+PSGML, XMetal)
doesn't add much comfort for entities while everything else
is much more enjoyable than using a plain text editor.
Particularly XMetal seems to actively discourage the usage of
entities.
As for alternatives: For character references, even moderately
sophisticated editors could display the correct glyph or a human
readable name regardless of what's in the file. For everything
else, either expand it or use markup in case you have to
eleminate redundancies. For example, instead of
  <!DOCTYPE doc SYSTEM "doc.dtd" [
    <!ENTITY author "Random J. Hacker">
  ]>
  <doc>
    <title>Stuff by &author;</title>
    <section>
     <para>The person &author; did...
  ...
use
  <doc>
    <references>
      <person id="author">
        <name>Random J. Hacker</name>
      </person>
    </references>
    <title>Stuff by <refname id="author"/></title>
    <section>
       <para>The person <refname id="author"/> did...
  ...
Of course, you'll have to have an editor which can be customized
to do something sensible with the references, and some ressources
to do the customization (the latter is usually the killer).
Hiring a good data designer may also be a good idea (but may
turn out to be a showstopper too, sadly).

As for the relation between entities and performance: until
namespaces were introduced, XML parsers indeed could have
entities preparsed and thereby saved some time. Whether this
would save much is doubtful, because the preparsed tree would
have to be copied when the reference is encountered, an
operation which is nearly as expensive as constructing the
tree by parsing a string. Furthermore, i believe using a similar
optimization in SGML would additionally require some non-trivial
bookkeeping so that no one ever did this back then.

Regards
J.Pietschmann

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread