Listen Print Discuss
XML and Web Sites

XML and Web Sites

by John E. Simpson
October 30, 2002

In the USA this week's calendar includes Halloween: a time when spooks, zombies, and assorted denizens of the realm of the undead are said to walk the earth. It seems an appropriate moment to tackle one of the most gruesome questions recently posted to the oreillynet.com XML forum.

How do I build a Web site using XML?

Q: I need help learning how to construct a Web site using tools to allow dynamic content creation. Specifically, I am searching for books, tutorials, how-to-bang-my-head-against-the-wall instructions, that sort of thing. This is what I know: XHTML, some basic XML, and CSS. I understanding concepts of programming...

This is what I want to know: how to build a site using open-source (i.e. free) software that allows me to provide dynamic content. This dynamic content would include trivial things such as reporting the weather for a zip code I specify to not-so-trivial things such as allowing a user to change the associated stylesheet so that they could specify font, font-size, background color, and other properties through an interface form and these attributes would be remembered the next time the user visits the site.

I'm also interested in understanding more about using databases to construct content for Web pages.

Technologies that I find fascinating and seem (to me) useful in implementing what I'd like to do are PHP/mySQL, SOAP, XML-RPC, and Perl.

My operating system is Mac OS 10.2. I have webspace that does not allow a command-line interface connection. Is this needed?

A: What a mouthful! Let's see if I can tackle your questions one at a time; and let's hope that you have plenty of time on your hands.

Related Reading

Learning XML

Learning XML
Guide to Creating Self-Describing Data
By Erik T. Ray

Table of Contents
Index
Sample Chapter
Author's Article

Read Online--Safari Search this book on Safari:
 

Code Fragments only

Books and tutorials

A good starting point for this kind of question is XML.com's own XML Resources section. (Look down the menu at the left side of this page; it's listed under "Guides".) Once there, for instance, follow the link to the page on Tutorials.

A notable recent addition to the list is Simon St. Laurent's "Monastic XML" site. It's not a tutorial in the traditional sense; there are no code fragments, no detailed discussion of Java or the DOM, no demonstrations (annotated or otherwise) of server- or client-side processing. Instead, it's simply "an ascetic view of XML best practices," directed at developers who want to know not the best way to achieve Result Z with XML, but rather (as St. Laurent says) "what markup is best at." This wouldn't be a bad place to drop by if you're already familiar with XML -- especially if you're so excited by the technology that you want to use it for everything.

Excellent tutorials of the more conventional sort, laden with how-to information and examples, include the following:

  • Zvon.org tutorials: presented by Nic Miloslav (lecturer in the Department of Organic Chemistry Education, ICT Prague) and the Zvon information exchange. A wealth of comprehensive tutorials on XLink, namespaces, RDF, XML Schema, XPath, XSLT, and other important topics.
  • The Web Developer's Virtual Library (WDVL) tutorials: like the Zvon site, above, the WDVL site includes copious lessons on a wide range of XML-related subjects. While there, also check the numerous links to other resources. Don't overlook the resources on some of the other topics you mentioned, like PHP, Perl, databases, and CSS; often, the most pragmatic advice on implementing XML with such tools can be found on sites devoted to the using technology itself, not from sites focused on XML as such.
  • The W3Schools XML tutorial: especially recommended for beginners to XML, with plenty of examples.
  • The skew.org XML tutorial (by Mike J. Brown): delves into a subject often overlooked in other tutorials -- Unicode, ISO/IEC 10646-1, and the Unicode/UCS character encoding model.

As for books, I'm partial (perhaps for obvious reasons) to O'Reilly's list. Books listed there have sample chapters posted on-line and are also available in full via subscription to the O'Reilly Safari venture. If you're familiar with O'Reilly titles on other topics, you know what to expect from their XML titles: clear writing, no beating around the bush, and a reputation for technical accuracy and thoroughness.

Another publisher to consider is Prentice Hall-PTR, home to the Charles F. Goldfarb "Definitive XML Series." Goldfarb, as you probably know, is generally credited with shepherding XML's predecessor, SGML, into widespread acceptance. Goldfarb has edited the books in the PH-PTR series; you can be sure therefore that their content will be accurate and authoritative.

(Regardless which book(s) you think you're interested in, always be sure to read not only what the publisher has to say, but also how reviewers and other readers have responded to them. Buying a book on the sheer strength of its title, the author's name, the pictures on the cover, and so on, is a sure prescription for disappointment -- not just your own, but the author's.)

XML software

One of the first (and, I think, still best) sites for general information about software for processing XML is the eponymous xmlsoftware.com site, begun by James Tauber and kept very up-to-date by Tauber and Linda van den Brink. The site is organized according to application type, such as XML parsers, XML editors, database systems, content-management applications, and the like. Since each package is described not only in a brief capsule summary, but also in terms of version, platform, developer, and revision date, finding what you're looking for is simply a matter of using your browser's "search" feature. For instance, while preparing this column I checked the page of information about XML editors; searching on the string "mac" yielded seven Macintosh-compatible editors (as well as a handful of Emacs-based or Emacs-like packages).

Also check Lars Marius Garshol's site for a well-organized list specifically of free XML tools (xmlsoftware.com's listings including commercial as well as shareware/freeware products). Among the ways in which software is categorized here is by platform -- especially important for users, document authors, and developers occupying the non-Windows/non-*nix portion of the landscape.

XML and databases

By far the best starting point on this subject is Ron Bourret's XML and Databases site. The main page links to specific sections/pages on topics (like "Why use a database?" and "Data versus documents"), but especially to a wonderful sub-site, XML Database Products, which lists (albeit with minimal commentary) a host of these important applications, by category (e.g., XML application servers, XML query engines).

Don't overlook what the big database vendors have to say about XML, either -- in many ways, perhaps surprisingly, they've led the effort to break away from the constraints of proprietary solutions. (Of course they're not wholly altruistic; each has adopted specific strategies for keeping their customers "locked in," while encouraging open and platform-independent data interchange via XML.) IBM and Oracle are the leaders here. Just remember to consult Bourret's XML Database Products, above, for information on other vendors as well.

Providing dynamic content with XML

This is starting to get into the nebulous-buzzword corner of the XML universe. Still, you've supplied some idea of specifically what you're looking for on this subject.

As I mentioned above, the XML.com site itself has loads of information -- columns, features, resource guides, and so on -- on just about anything XML-related. You can search the site on "dynamic content" to get an up-to-date list of relevant material. (Note: when I searched on that string just now, I got over 1500 hits. Not all of these are truly full-blown XML.com features, however; many are links to pages of simple descriptions of products -- open-source or otherwise -- which then just link to the vendor's own site.)

A different (and maybe forgotten) approach to getting your feet wet here is to check recent (at least reasonably so) issues of technical periodicals. Much of the content for these magazines is available on-line, especially their back issues, and directly addresses the needs of developers. For instance, the April 12, 2001, issue of Network Computing included a brief, clearly written overview of the main products (Microsoft, Oracle, and the Apache Project's open-source Cocoon): "Dishing Up Dynamic Content," by Ahmad Abualsamid. Visual Basic Web Magazine (VBWM) also covered the subject in a brief (but undated) column, "XML Corner: Dynamic content for your applications." I myself have often turned to New Architect (formerly WebTechniques) for this kind of information. Their back-issues search page, as of a few moments ago, turned up 63 articles when fed the string "dynamic AND content AND xml."

Also in XML Q&A

From English to Dutch?

Trickledown Namespaces?

From XML to SMIL

From One String to Many

Getting in Touch with XML Contacts

Remember one thing when it comes to "providing dynamic content": what makes it dynamic isn't the tool, or set of tools, which you as the developer employ to create the XML document(s) and the code which delivers it. The developer can use a simple text editor for any of that work. No, what makes it dynamic is the way the content is served, and/or the way the content is processed by a so-called "user agent" (like a browser or other client package). Your operating system -- be it Mac OS 10.2, or Windows 2000, or Linux, or whatever, whether it has a command-line interface and so on -- needn't be a consideration when you start worrying about delivering dynamic content. Successfully delivering the content depends on the capabilities of the server you choose and/or those of a client. A command-line interface to the server itself isn't generally necessary.


Comment on this articleHow are you using XML to build web sites? Share your experience in our forum.
(* You must be a
member of XML.com to use this feature.)
Comment on this Article


Titles Only Titles Only Newest First
  • Card XML
    2003-02-01 15:18:11 Mike DeWolfe [Reply]

    Most web pages have meta tags. Somewhere on the site, there is contact info (address, email address). None of this info is centralized in a single, simple to find spot.


    - People have gotten really random with where they put them. Some people put them AFTER JavaScript and/or make the meta tags hard to find. A card.xml file could get read by a very small and simple application. You could even
    make a client-side spider written in JavaScript.
    - Meta tags have little provision for providing content info (like street address, etc.)
    - The associates function can make a relay-race function into a way to find a whole slough of websites without relying on spiders to crawl through text and parse out URLs.


    I have set up something I call "Card XML." It's an XML file that resides in the root of the web server directory. It lists the website address, its title, information like description and keywords. It also lists address, phone, fax and other contact information.


    I added a field called "associates." I hope that these associated links link to other sites with Card XML files. That way, one Card XML file can pass you onto other sites and create a network of Card XML data.


    I haven't come across the equivalent of this XML concept. If there is one, I would like to see it.


    A page with more info is at:
    http://www.epico.info/makecardxml.html



    - Mike DeWolfe

  • I am a newbie, i guess :)
    2002-11-08 06:58:57 Sherzod Ruzmetov [Reply]

    I recently staretd doing XML, and I tell you, i'm already in love with it. To test out my knowledge I converted my homepage and Perl POD manuals to XML and serving them all now from my website dynamicly through XSLT.


    http://author.ultracgis.com


    I'm doing it by installing an apache action and assingning the action as a handler to all the files with .xml extension. The action is a simple Perl script which calls "xsltproc" ( which used libxslt ) on $ENV{PATH_TRANSLATED}


    To view pre-profecessed content, just append "?cmd=source" to any URL ending in .xml.


  • Some pointers....
    2002-11-03 13:38:08 Mario Valente [Reply]

    ...to example sites that we've built using XML.


    All are done in Zope/Python.


    http://downloads.oninet.pt/ and http://jogos.oninet.pt/ are both in XML and presentation in XSLT. You can go to /index.xml at each of them to check out the pre-processed source.


    http://www.daaz.pt/ is done in XML and presentation in CSS


    These are all in Portuguese. We have a site right now in beta at http://www.blogdot.org/ (yes, its a blogging site :) also done in XML+CSS which is English.


    C U!


    -- Mario Valente


  • For perl and xml
    2002-11-03 02:59:50 Matt Sergeant [Reply]

    Check out Apache AxKit, an Apache project similar in goals to Apache Cocoon, though developed entirely independantly. There's a really good series of articles about AxKit running currently on perl.com covering everything from getting started, up to building complex applications. The full list of articles is on the AxKit wiki.

  • XML is no different from other technologies
    2002-11-01 00:21:16 Toni Lassila [Reply]

    Building a dynamic content system using XML-enabled technologies is done exactly like building a dynamic content system without using XML-enabled technologies. Don't use XML-features because it's the latest buzzword and you like to have as many buzzwords as possible included, but because you have identified certain features or techniques that could benefit from XML and its feature set.


    If you need to do transformations on structured data that's in XML form, use XSLT. If you need XML documents that follow a strict convention, use XML Schema validation. If you need to manipulate or access data that's in XML form, use XML DOM or SAX. If you need to do searches into XML data, use XML Query etc.


    Once you've identified the required features of your dynamic content service, detail them on some public forum and ask peoples' opinions on how they would do it, or study samples of working solutions and see which of them match your requirements.


    Anything that can be done with XML can be done without XML. In some cases it's the right tool for the job, and only by experimenting and studying existing solutions can you learn when and where to use it.

  • PerfectXML, grat reasource for all things XML
    2002-10-31 07:05:41 Satwant Khalsa [Reply]

    I found out about this site once via searching on google about MSXMLm and found http://www.PerfectXML.com to be a very informative, up-to-date and covering range of topics for both beginners and advanced XML developers.