[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Scripting and XML
Simon St.Laurent writes: > XML at this point seems to be exceptionally well written for a > model in which the data is passive and gets processed by an outside > application - the parser/application combination. It doesn't seem > like it will work very well, however, with a model that is rapidly > growing more popular in the HTML world: scripts included in the > same document as the data. While this blending of data and > processor is admittedly a little unusual, it is becoming standard > practice more and more often. [Remainder omitted] One reason that I've never tried JavaScript (other than the security holes) is that -- as far as I can tell -- there's no way to put the code in a separate file from the HTML page. There are enormous advantages to maintaining processing code separately from markup: 1) you can change processing strategies (or even the code language) without having to rewrite your documents; 2) the code is easier to maintain; 3) you can reuse the same code for dozens (or even thousands) of different documents; and 4) you can use your documents for more than one purpose. With CSS, for example, it makes much more sense to write a single, separate stylesheet for your whole web site than it does to embed a separate stylesheet in each document -- in programming terms, it's the equivalent of using a subroutine instead of writing identical code dozens of times. While it is entirely legitimate to use PI's to embed code, it is nice to keep the code as abstract as possible; for example, instead of <?select * from people where name='david'?> I'd prefer something like this in the document: <?query dpquery?> and then something like this in a separate source-code file: declare query dpquery { select * from people where name='david' } That way, I can find bugs more quickly, and I can change query strategies (say, by switching from SQL to an OODB query language) without modifying my documents. Normally, I recommend including code within the document itself only when the code is logically part of the document -- in literate programming, or when the source code is included as an example. All the best, David -- David Megginson ak117@f... Microstar Software Ltd. dmeggins@m... http://home.sprynet.com/sprynet/dmeggins/ xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|