|
|
XML Meets Java...and Meta DataBy Nate Zelnick One of the problems with XML today is that, while there is a tremendous amount of exciting work going on, there are very few easy places to demonstrate it in action. Which is a shame because while XML is conceptually quite complex, its application is really very straightforward. The problem is that browser support is sketchy. For instance, the sample application that follows would work natively in Microsoft Internet Explorer 4, but not in Netscape Navigator 4. Navigator 5 has total XML support, but I'm not going to ask you to compile from alpha source code to see this demo. Support should be broad-based by late this year, which makes now an excellent time to get a grounding in the conceptual underpinnings of XML. This is an application of XML, albeit a simple one. It requires Java, so if it takes a while to load, just be patient (Warning: you'll download about 500 KB of data when you click that link -- Ed.). It's an application of an XML vocabulary developed by Microsoft for its push strategy introduced in Internet Explorer 4.0. It uses Pax Syntactica, a Java-based parsing engine developed by Datachannel Inc.'s Chief Architect John Tigue. I adapted the example from a sample application posted on Datachannel's site. I used Pax Syntactica because it provides one of the few readily available cross-platform cross-browser demonstrations of how XML works available today. There are lots of good uses for XML hidden back in a middle tier of a 3-tier client-server application, but that would lack the immediacy of this demo. We'll explore this and ways to directly render XML-structured documents in future articles. What's going on here is that the parser is pointed to an XML document that describes the set of sites in each channel. That document, which follows the Channel Definition Format, consists of a set of terse descriptions of each channel and items within it. For example, the top-level channel is defined like this:
<CHANNEL HREF="http://www.webdeveloper.com/xml/"> <TITLE>XML Files</TITLE> <ABSTRACT>A set of links to XML-oriented information</ABSTRACT> <AUTHOR VALUE="Nate Zelnick"/> and points to the XML Files home page. That Channel, which constitutes the top-level object in the document, contains sub-Channels which themselves contain Items. The Channel is closed at the bottom of the document using a familiar "close tag" syntax of </CHANNEL> The syntax of XML should be instantly familiar to Web developers, since it follows the same ideas of tagged data and containership that are the key to structuring HTML documents. This should not be surprising since, as we covered in the last XML File, XML is related to SGML (of which HTML is just one instance). XML allows you to create new--and arbitrary--vocabularies of tags to create structure. [ Click here to move to the next part of the article ]
Contact the WebDeveloper.com® staff Last modified: Friday, 22-Aug-2008 13:46:48 EDT
|
Refresh Daily
|