The friction that really wears us down is at the interface between people and data. I'm not too worried about how we represent XML fragments, but very curious about how we enable people to interact with them. These little experiments are hardly conclusive, but they do hint at the still-untapped potential of the scriptable document object model. [Full story at O'Reilly Network]
A glitch that affected the live examples in that article is being repaired. Meanwhile, I'm reproducing the examples here. The first is a DOM-aware citation bookmarklet (Mozilla-only, alas). This is the text of the bookmarklet:
And here's the actual quote bookmarklet, draggable to your linkbar if you're running Mozilla.
The next example uses similar technology to find a fragment of XML matching some pattern, lift it out of a web page, and do something with it. In this case, the fragment is simply echoed to a window. One link finds a fragment with a cal:date attribute, the other finds the enclosing fragment with a cal:range attribute. Click on one or the other of the events to set focus first.
Just this morning, I read a well-reasoned argument on the fragility of XHTML. I can't really disagree, it's true that the effort/reward ratio is currently out of whack. But for what it's worth, I'm looking for ways to reduce the effort required to create and maintain the stuff, and increase the rewards for doing so. Note that in the case of these calendar fragments, it's not actually necessary for the whole page to be valid XHTML. Well-formed fragments contained within documents that are not themselves guaranteed to be well-formed is a possibility, and maybe a useful possibility.
Update: When I transplanted the calendar example from the ORA site to here, I noticed something odd, the significance of which didn't sink in until just now. The sample fragment in the published article was not well-formed. I wrote the article in an XHTMLish way, but didn't it vet it for well-formedness -- as I do now for what I write here. As it turns out, the table containing the calendar fragment was ill-formed. I've corrected the version shown here, just to keep my XML database clean, but the fact is that I could have published the ill-formed content, exploited the leniency of the browser, and still been able to extract well-formed fragments from it. Hmmm.
Former URL: http://weblog.infoworld.com/udell/2003/10/09.html#a824