For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
XML, HTML, XHTML and more
HTML is a language ... but XML is a Metalanguage. In other words, you can write something in HTML and have it (quite) well defined, whereas anything you write in XML has to have another layer of definition there to tell you what's valid and what isn't. XML is a set of over-arching rules in which you can define your own, XML compliant, language ... or use one that someone else has already defined for you, such as RSS, SOAP, REST, or XSLT or XHTML. Here's a diagram:
It's been said - and it's usually the case - that if you define your data using HTML, then you're defining how it looks
, whereas with XML you're defining what it is
. For example:
- says how it should appear:
<h1>Melksham Town Center</h1>
<ol><li>Woolworths, Boots, Peacocks and Iceland
<li>All the major banks
<li>Tourist Information Center and Post Office
<li>Bus to Bath, Devizes, Chippenham and Trowbridge
- says what it is:
<place>Melksham Town Center
<banks><item>All the major banks</item></banks>
<general><item>Tourist Information Center</item>
From that, you'll see that you can see how the HTML will be displayed, but you don't know how the XML will be used of displayed. There needs to be a tailored intermediate piece of software specifying that, and doing the work. You may come across:
- The S
PI (Application Programmer Interface) for X
ML (Extensible Markup Language)
Using SAX, a stream of XML data is passed through a process (scanned by a program) and the interesting bits that the program needs are collected as it does. I've describe this as pouring a lot of water through a sieve, and catching the bits that you want in the sieve. SAX is ideal for getting a few specific elements out of a very large flow of data, but is exceedingly poor for reading XML to edit and re-save it.
- The D
In DOM, Data is parsed into a structure in memory. An XML document is a series of tags ... so each of those becomes an array or list (depending on the programming language that you're using), and within each of those you have other tags which in turn become further arrays or lists within the first. Attributes - not touched on in this article - become hashes, dictionaries or associative arrays, and the text data is stored as strings in the arrays. So this translates from file to something that can be held in memory and, with carefully written recursive code, manipulated very flexibly indeed. DOM is good for smaller data sets, and it's a great tool if you want to edit and save changes to your original XML. It's not going to work for you if you have an enormous XML file.
tyle Sheet L
XSLT is a language which allows you to specify how your XML is to be transformed, SAX style, as you parse it. You can write formatting information, tags, loops and all the other things you're used to in XSLT ... and the result of an XSLT transform is likely to be XHTML. Let's say you have 60 staff, with an XML file holding records for each of them. And you want to display the data in 3 different ways. Then you'll write 3 XSLT files to define the mappings, and the result will be that you can get any of your 60 x 3 (=180) possible displays. XSLT happens to be itself defined to the XML standard ...
Apache Cocoon is a system that allows you to take XML and transform it into different formats for different purposes - taking my "staff record" example again, I could set up Cocoon to give me postscript files for printing, XHTML for display, selective XML for public release via a news feed, pdf for producing a flyer about the employee, and so on.
And how does XHTML
fit into this?
XHTML is HTML with the additional rules of XML enforced - so that although you're laying out how things are to be displayed rather than what they are, you're also specifying that in a consistent form that's easy to edit with HTML editors and will cause less headaches as you view your page on different browsers - assuming you stick with standard tags!
Our example in XHTML:
<h1>Melksham Town Center</h1> (written 2008-11-23)
<ol><li>Woolworths, Boots, Peacocks and Iceland</li>
<li>All the major banks</li>
<li>Tourist Information Center and Post Office</li>
<li>Bus to Bath, Devizes, Chippenham and Trowbridge</li>
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesA301 - Web Application Deployment - XML, DTD, XSLT, XHTML and More 
Easy feed! - (2006-03-21) 
The HTML++ Metalanguage - (2007-01-22) 
What difference does using the XHTML standard really make? - (2009-06-18) 
Handling XML in Perl - introduction and early examples - (2009-08-27) 
Adding retrospective ALT attributes to IMG - (2009-12-28)
Some other Articles
A Gold Star for First Great Western Customer ServiceRuby, Perl, Linux, MySQL - some training notesdaemons - what is running on my Linux server?sstrwxrwxrwx - Unix and Linux file permissionsXML, HTML, XHTML and moreTable TopicsVirtual Hosting under Tomcat - an exampleEvery cloud has a silver liningKeeping on an even keelVirtual Hosts and Virtual Servers
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).