one hundred industrial-strength tips and tools
XML is everywhere today – from web pages to mobile phone messages and automatic feeds from blog sites. On the surface it’s simplicity itself: just put everything between tags. But as Michael Fitzgerald admits here in this excellent new guide XML Hacks, once you get below that surface it’s complex stuff. Fortunately, his approach simplifies matters by splitting up his explanations of how to get the best from XML into easily digestible chunks.
Each explication or hack covers a single topic, and each one is followed by suggestions for further reading, free downloadable resources, and web links to either specifications or other tutorials on the topic. And all the working examples he discusses can be downloaded free from the book’s own web site – which is a very good idea.
He starts off by explaining the basic structure of an XML document and how its content can be displayed in a browser using style sheets. There’s also a brief discussion of the free tools available for XML editing, and where to find validators to check your results. I liked the fact that the outcome for each new line of coding is shown in a screenshot, so you can see what you are doing at each stage.
It’s assumed that you may wish to convert existing data into XML format, so there’s plenty of advice on using a whole range of conversion tools, and even the latest version of Microsoft Word.
Every now and then you’ve got to be prepared for some of the abstract language in which these explanations are often expressed
XML has a concept of a document entity, which is a starting point for an XML processor. A document entity, from one standpoint, may exist in a file with an associated name. However, from the standpoint of the XML spec, a document entity does not have a name and might be an input stream that has no means of identification at all.
Fortunately, each separate topic is given a difficult rating – beginners, intermediate, or expert – so you can pick your way through at whatever level suits you best.
He includes discussion of new features in the XML spec which were still being ratified by the W3C consortium whilst the book was being written. You couldn’t get much more up to date than this.
As the book progresses he gets into the more advanced features of XPointer and XSLT (Extensible Stylesheet Language). These made my brain hurt, but are obviously useful for transforming documents from one form into another.
The examples range from generating PDFs and spreadsheets from XML documents, to grabbing data out of your iTunes Library files, and even generating scalable vector graphics (SVGs).
After XML Schemas, Relax NG, DTDs, Trang.jar, and XForms, it was something of a relief to reach a practical application I could understand – syndicating the content of blogs and web sites using RSS (really Simple Syndication). This describes the available software for receiving news feeds and for creating documents which can be sent for syndication. There’s also a nifty freeware program for adding other people’s syndicated news to your own site.
He ends with some advanced hacks featuring programs such as Cocoon, Ant, Wikis, SAX, and Genx. The mind boggles. Well, mine does anyway.
As you can probably tell, there is something here for everybody – from beginners (where I felt reasonably comfortable) to intermediate (something of an aspiration) and advanced (which I imagine will remain terra incognita to me for some time to come).
© Roy Johnson 2004
Michael Fitzgerald, XML Hacks, Sebastopol, CA: O’Reilly, 2004, pp.460, ISBN: 0596007116