Validate, Validate - I’m Late For A Tea Party!

“It compares your markup to the set of rules your Doctype states you have made the page to conform with”

In the last back to basics on Pig Work - Document Type Declarations - I didn’t commit anything to the page about validation on purpose. Validation has its own converstion. I’m talking about Hypertext Markup Language (HTML) validation at this point to be specific. I’d suggest Cascading Style Sheet (CSS) validation is also important from the earliest stages.

What does validation do? Well it compares your markup to the set of rules your Doctype states you have made the page to conform with. Its about making sure your code is well formed and doesn’t have inadvertant errors in it. A general principle of software engineering of any kind goes

If someone touched it, edited it, opened it in code view - its broken!

That’s the assumption you should work with and at least in development you really should put links to automatically validate your XHTML and CSS on the fly. If you make a code change - revalidate the page. Any software engineer will explain to you how this in fact will save you development time and therefore money.

And no I’m aware validation won’t make your page accessible by itself but I’d strongly suggest in practice not validating your page would extremely increase the likelihood your markup IS bloody inaccessible. If you can scan 25 nested tables in 10 seconds and tell me where a closing tag has a missing td then you’re a legend. And the same goes for meeting the finer points of the respective specification. Shit you’re Superman! So validating not only makes for faster development of web standards documents but also vastly increases the likelihood of your site being accessible. Don’t worry about argueing that one with me because the logic is irrefutable.

While automated validation has its limitations it should be the FIRST place you stop. Then go into your code and manually look at what you’re doing. Automated and then manual - its easy enough. A lot of Web Content Accessibility Guidelines 1.0 (WCAG) points need to be looked at manually and involve educated decisions.

If you have a problem with your page rendering oddly or its not working cross browser please don’t email me with a question until you’ve validated your code! Its vital, especially if you’re making CSS layouts. If you’re using table layouts I probably won’t answer you anyway but there you go - another issue entirely.

When I’m working I absolutely cane the HTML Validator and CSS Validator. When I’m reasonably sure I’m up with a running prototype I start running the WebXact Accessibility Validator and the WAVE 3.0 Accessibility Validator. There are a number of different ones out there for accessibility and they offer some basic indications of where you may want to look - once again only manual checking for accessibility will give you best results but I’d first run the automated checks before digging into the code.

If you use Internet Explorer I’d suggest you go straight over to the National Library Information Services (NILS) site and download their Web Accessibility Toolbar - WebAIM have a short tutorial on using the Web Accessibility Toolbar. If you use the Firefox browser you’ll want to get Chris Pederick’s Web Developer Toolbar - once again WebAIM have a tutorial on using the Web Developer Toolbar.

If there’s one thing you ever take away from Pig Work it needs to be the emphasis on validating your markup to ensure the quality of your code meets the specification of your Doctype! The same goes for stylesheet validation.

Which Doctype to use is up to you but I agree entirely with Roger Johansson on this one - HTML or XHTML - does it really matter? - it should be either Strict HTML or XHTML.

Go to sites like Accessify, WebAIM, Access Matters (you’ll notice me in their links list - Steven Clark), and frequent Roger Johansson’s 456 Berea Street so you can get a broad exposure to the conversation. Joe Clark is on the MUST READ list! Join the Sydney based Web Standards Group mailing list which now serves near 3000 members worldwide including a number of high profile international identities. Regularly visit The Web Standards Project (WaSP), the World Wide Web Consortium (W3C) Web Accessibility Initiative (WAI), read the Web Content Accessibility Guidelines 1.0 (WCAG) and get into some of the finer points of the various specifications.

If you don’t think validation has a place then I’d say you’re pushing shit uphill to get an accessible web site. Its not the be all and end all of writing good pages but validation has its place. It is the starting block for the ongoing event. Don’t let anyone convince you validating is corny - its necessary.

Hopefully this back to basics was as enjoyable as it is long. Put validation links at the bottom of your pages during development and ensure you’ve got well formed code right from the get go.

The Uniform Resource Indicator (URI) to put on your page for validating HTML -

and for automatically validating your CSS -

An example I saw this week was where an XHTML document validated but the CSS validator returned an ugly old error from malformed markup. Simply the right number of tags were there and apostrophes but there was a bit of extra white space and an apostrophe out of place making it invalid Extensible Markup Language (XML). It pays to validate!

2 Responses to “Validate, Validate - I’m Late For A Tea Party!”

  1. Matt Robin Says:

    These ‘back to basics’ articles from you are great…

    This one is slightly less basic for some of the more novice visitors to your site though…this one probably could’ve been split up across a few e-mails…well…maybe?!

    I remember back to when I started learning HTML…and I vaguely knew of standards…but in most of the texts I was reading, it seemed almost ‘optional’….and because it does take more (a lot more) effort to get somethings to ‘validate’…AND seems optional…I think the newbies, sorry…err….novices…simply chuck it to one side and abandon it until they think they are doing anything serious enough to warrant giving it a second look.

    The values of valid markup are obviously why we (you and I, and others) have embraced web standards….and those values need to be promoted at the outset for people who are learning the basics…and know that while it might be ‘optional’….it probably shouldn’t be optional at all…it should be one of their core aims right from the start!

    Hmm, does that blog comment work?
    Looks like I’m sort of repeating your sentiments a bit…. (and I don’t want to do that!) :)

  2. nortypig Says:

    Hi Matt
    Mind numbed after 8+ hours of trolling tables and pulling out p’s breaks and odd parephenalia, and having someone put me on show as to “who told me there should only be one H1 per page” - ahh your comment is a pleasant end to the day mate :)

    Someone with sound sensible values…

    yeh I’m an XHTML and CSS validation hardcore but you can’ t twist people’s arms. At present I’m Quality Testing and I’m not even allowed to validate a page! Ha. What can one say in the face of it all? Its work and I’ll leave my wise words of warning through my QA notes but at the end of the day its a job to pay for my real interests. Kind of feels like selling my soul in a way though… ha that’s my whinge!

    My opinion of it though is more long term. In the end its good to be in the heart of a slow changing beaurocracy just to oil the gears of best practice. A lot of it won’t show in the short term but as climates and understanding evolve there’s hope - work from within.

    Yeh the comment was too long but I just had so much fun. I might just republish a very basic version of each part now so when newbies Google it they don’t go ballistic and run! The basic message is what’s important there.

    Anyway thanks for commenting Matt, its been a long day and I have to cook the meat while Lindy does the vegies. Cheers :)