Lists Home |
Date Index |
From: "Robert DiFalco" <email@example.com>
> Of course, this isn't a big deal if my program is producing and
> consuming the XML. However, if I am consuming a document that a user
> produced, why should I force them to put FirstName, LastName, and
> Occupation into a particular order? A Person is still a Person if they
> appear as LastName, Occupation, and FirstName.
When thinking about XML in general, keep in mind that one popular
method of processing XML, especially for very large documents
or for very small documents, is to parse the document not into a
tree or database tables but into a stream of events.
For this kind of streaming processing, you don't have random access.
So the more that the incoming data events are in the typical sequence
that they will be used, the less that a programmer has to divert the
events to a temporary store for later use.
The best practise for XML documents that may be processed by
streaming applications is to utilize document order as much as possible,
as the primary technique for reducing workload.
In particular, what needs to be avoided is lookahead. Decisions by the
notational users of the document, as far as they can be modelled ahead
of time, should not need to require information later in a document
to make decisions early.
Examples of this might include:
- having names in order (Robert's question);
- putting footnotes at the start of a section or inline rather than at the
end (it seems counter-intuitive);
- having a <constants> section at the head of a document for
strings that will be used throughout the document, for consistancy;
-embedding information sourced from databases that only appears once
inline, in the position it is expected, rather than using some kind of
reference to a later (or even earlier) element.