XMLWarning: In this blog entry I rant about web development, not the usual
video games or pop culture. Boring technobabble ahead!
I have come to the conclusion that XML is a royal pain in the...
Actually, it's not XML that's so bad. It's XSL, the gizmo used to convert
XML files into something potentially more useful, like HTML files (XHTML,
technically, but same difference). XSL has delusions of being an actual
programming language, but really it isn't, so there's a whole lot of
little gotchas just waiting to trap some unsuspecting would-be developer who
thinks his programming knowledge is going to help him master this XSL stuff
(not that I would know any). You get "if" statements without any "else"
statements, but hey, you also get "choose/when/otherwise" statements that do
the same thing with new words! Someone must've been allergic to "else." Then
there are variables. What's the point of calling them "variables" when you're
not allowed to change them after setting them? I believe programming languages
usually call such things "constants."
So it's little things like that that are bugging me. Adding to the
annoyances are the tutorials at w3schools.com. Okay, before all the web geeks
start writing me hate mail, let me say I think w3schools.com is an excellent
source of information for web development, and it has certainly helped me
master CSS, XML, and yes, even XSL and that XPath thingy they swear is
necessary to use XSL effectively. But the tutorials leave out a lot of
important stuff that instead has to be dug out of the reference sections. For
example, you're shown how to handle elements that have either text or child
elements, but what about elements that have both? Then you're shown how to
access the child elements of elements being traversed in a for-each loop, but
how do you access the traversed elements themselves? The answers are there,
waiting to be discovered, but it takes careful reading of the reference
sections, and in my case, searching for other tutorials on Google, to get to
them.
And what's the deal with using example code that requires Internet Explorer
to work with??
All right, enough complaining. The web site is coming along. At this point
I have all the text written for what will be the first six entries:
Donkey
Kong,
Joust,
Moon Patrol,
Pac-Man,
Tetris and
Xevious. Once I do a bit more polishing on the CSS's, XML's, XSL's,
PHP's, ABC's and 123's, we'll be good to go!
Oh, one more complaint. You're supposed to be able to validate your XML
files against a sort-of blueprint or template file called a DTD file. The DTD
file to be referenced can be declared within the XML file itself, using a
"DOCTYPE" tag. This DOCTYPE tag technically is not a valid XML tag. That's
not supposed to be a problem; XML parsers are supposed to ignore such tags.
However, the PHP 4 function that does XSL transformations chokes on this tag.
Maybe PHP 5's XML functionality handles it better, but my web host uses PHP 4,
so I'm stuck with that at the moment. Oh well, I'll just have to trust
myself to create valid XML documents. As picky as XSL is, I'm sure any error
will be swiftly tripped over.
Note for the future: Once I can start playing with DTD's again, check back
with
w3schools' DTD tutorial.
See, I still like w3schools.com!