23 August 2003
Comment validation using a modified (see below) XHTML Simple schema. Test it, break it, tell me about it.
Yesterday I briefly mentioned the idea of using a schema to validate weblog comments. It’s only really useful if you use XHTML on your site, but hey, that’s one of the benefits of using an XML format — you pays your money, you takes your tools.
Now I’m sure I’m not the first person to have thought of this, so I searched for an implementation. If there are any out there, they’ve been a bit backward about coming forward, and so I’ve built my own. In case of disaster (I have just installed a hard drive that dwarfs its new partner), here’s what I did at the schema level. The actual VBScript code is incredibly simple once the schema’s right.
html, body, or head, so remove them from structure.xsl.link and title aren’t very useful.div for validation. Unlike entries in RSS feeds, comments are divs. If you’ve got some kind of weird system — and I’m not talking mailing lists here — where they’re shown on individual pages, then perhaps they aren’t. But really this doesn’t matter.div from the block elements allowed: what’s the point? Also get rid of the semantically-dead span.class or id attributes, they’re bound to be bad news.address element isn’t that useful.a its full complement of attributes: hreflang is of type language; rel and rev are more complex. Sean Palmer, who wrote the XHTML Simple schema, seemingly never received an answer to his question about how to reference them, so we’ll fake it.simpleType later, with a NMTOKEN restriction and enumerations listing the link types and we’re done.abbr, acronym, cite, code, del, dfn, ins, kbd, samp, and var to the
‘inlinenoht’
(no hypertext) group.group and a
‘phrase.attlist’
attributeGroup to reference in the element declarations.)uriReference
is a type, damnit.’
uriReference to anyURI
.choice only works like I want it to when you feel like it, Mr Parser.’
choice into the inline one, then change it to all.all won’t work, silly. Change back to choice, set minOccurs and maxOccurs on that.complexTypes and substitutionGroups.lis can only contain inline elements.I fucking hate XML schemas. That was a waste of a few hours I could have spent punching myself in the face.