W3C home > Mailing lists > Public > www-validator@w3.org > March 2007

Re: Feature request: validation by snippet

From: Brett Bieber <brett.bieber@gmail.com>
Date: Fri, 23 Mar 2007 07:24:14 -0500
Message-ID: <efa010fb0703230524s767a0ea6x2a1cd5896722776c@mail.gmail.com>
To: www-validator@w3.org

I've been holding back on this subject, but this gave me a reason to respond.

On 3/23/07, Michael Adams <linux_mike@paradise.net.nz> wrote:
> On Thu, 22 Mar 2007 21:24:39 -0400
> Stephanie Troeth wrote:
> >
> > When you are creating templates using any kind of templating system
> > that is part of a content management system, often you are only
> > creating markup for a module that will eventually appear within a
> > greater page.
> >
> > Hence, if you just want to validate the chunk of code that applies to
> > what you are building, a validator for snippets is immensely useful.
> >

I work in an educational institution, (www.unl.edu), and support a
network of web developers all across campus... and I would only
encourage them to validate snippets of code only if they were
troubleshooting why an entire page wouldn't validate. As David notes,
validation does depend on context. If someone is generating snippets
of HTML to be placed directly in any system (CMS or not), I would want
them to be competent enough to validate the entire page. In my
opinion, a snippet of valid code is of no use if it is sent to the
client in an invalid template.

I think the best way to accomplish this is to charge the CMS
developers to create systems that generate valid code within their
wysiwyg eidtors.... and when the system allows direct input of (x)html
- to not accept the code unless it results in an entire valid page.
--- Automated validation can get us closer to this.. at least when new
content is added.

We encourage developers to use our local instance of the validator to
batch check their entire site, and only once they've worked through
quite a few errors will they begin to understand the complexities of
valid code and what it means.
I really think a batch validation tool is the key to total site
compliance, not one that validates just snippets of code.

A few links which demonstrate the usefulness of this:

Re-reading this now I've somewhat lost my point -- that's what happens
when you don't have coffee yet.  We are all working towards a common
goal... and many ideas offered here are thought provoking, and
encouraging to see. :-) See my notes in response to Michael below.

> Not sure if you are using PHP or another system but how about just
> setting up a wrapper that includes the relevant snippet and validate
> that.
> ************
> <!DOCTYPE ...as required...>
> <html>
> <head><title>Snippet tester</title></head>
> <body>
> <?php include ("snippet.php"); ?>
> </body>
> </html>
> ***********
> You could improve this by entering the address of the file into a
> posted variable for inclusion:
> ****
> <?php $snippet_filname = $_POST['snippet'];
> include ($snippet_filename); ?>
> ****
> Getting the file to call the validator itself once generated is beyond
> my meagre PHP skills but is probably do-able.

So if the posted variable snippet is /etc/passwd... what happens then?
Just a cautionary note to show why this is a bad idea.

But, on the plus side --- for validation in PHP you could use

-Brett Bieber

http:saltybeagle.com aim:ianswerq
Received on Friday, 23 March 2007 12:24:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:51 UTC