Web hosting asp - 1344 Part V . Putting JavaScript to Work

1344 Part V . Putting JavaScript to Work written by software, not humans (although humans input the data via a user- friendly front-end provided by the software). Even so, the format of an OPML outline is extremely readable by humans, and, with little more trouble than writing basic HTML tags manually, you can represent an outline in this format yourself. A plain OPML file, saved as an .xml file, can be viewed through the native XML parsers of IE5+ and NN6. These parsers automatically render XML tags in the same hierarchical fashion as OPML encourages outlines to be structured. But such rendering is under strict control of the browser, unless you also get involved with XML style sheets (the XSL and XSLT standards), at which point, browser implementation incompatibilities can make the going tough. I liked the OPML data format when I first saw it, and I think it s a convenient way to convey an outline s data to the client, at which point JavaScript and the browser s DOM can take over to provide interesting visuals for the content and interaction with the content. Thus was born the last example of this chapter, in which the outliner s data is delivered not in the form of scripted arrays or hard- wired HTML DIV elements. Instead, the data arrives in its native XML (OPML) format inside an IE5+/Windows XML data island. Rendering of the native XML is suppressed, and scripts take over to do the rest. OPML outliner prep The appearance of widgets and text for the new outliner has changed to more closely emulate the kinds of outline presentations that you see in some Windows programs (see Figure 52-2). For demonstration purposes, the same frameset structure and outline content from earlier examples are used for the OPML version so that you can more easily see the differences in implementations and grasp new concepts presented here. For example, the comparison of how the outline data is delivered in the form of JavaScript objects (the first example) and OPML is enlightening. As you recall, a custom object constructor function generated one JavaScript object for each outline entry. The properties of the object are completely under your control, so that you can add properties (such as the target of an entry s link), whose values influence the way the entry is rendered and the way it behaves. OPML has a similar extensibility feature. Each outline entry is nothing more than a tag. An entry that does not have any nested child nodes can use the XML shortcut of combining a start and end tag inside one set of angle brackets: And any entry that has nested nodes contains the nested nodes between its start and end tags, as shown here with the actual tag names used in OPML (indentation is optional, but increases readability): We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Leave a Reply