[wp-hackers] XHTML Strict Mode

Jamie Talbot wphackers at jamietalbot.com
Mon Aug 23 14:40:08 UTC 2004


Hi,

Thanks for all the pointers regarding validation.

I've added to attribute correction the X-Valid plugin, with the result that it
should now fix unbalanced or non-existent quotes for attributes, warn for
non-existent attributes and warn for required attributes that are not present.
A fully automatic option is available in the code, but not presented to the user
yet, that allows for automatic removal of invalid tags and attributes and
automatic addition of required tags.  The code is a little bigger now, but it
can't be helped if a stripped down parse tree of XHTML must be included...  I'm
thinking that a future version might use XML with an option for switching
DocTypes, but that'll be later rather than sooner!

If errors that cannot be fixed are found, a window pops up containing a listing
of those errors.  It attempts to pretty print the input and output tags as well
so you can see the differences between input and output.  The user can opt to
see an output in any case by checking the Show Results box.

The attribute checking code being new, there are possibly (probably) as few bugs
that need ironing out.  I'd appreciate a bit of testing before it's released to
the unsuspecting masses...

The plugin works one time only, either on "Save" or "Publish".  "Saving and
Continuing" should allow for testing without making any test posts public.

http://www.jamietalbot.com/wp-hacks/

Has links to the plugin and source code...

Thanks in advance!

Jamie.

--
http://www.jamietalbot.com/


Quoting David Schlosnagle <schlosna at gmail.com>:

> You may want to check out this post about handling invalid XML in PHP
> 5.1 and libxml2. <http://blog.bitflux.ch/p1757.html>
>
>
> - David Schlosnagle
> <schlosna at gmail.com>
> <http://www.david-s.net/>
>
>
>
> On Thu, 19 Aug 2004 17:18:34 +0900, Jamie Talbot
> <wphackers at jamietalbot.com> wrote:
> > Hi,
> >
> > Currently working on a version that will handle poor attributes as well.
> Am
> > outputting double quotes in the parsed version, no real reason, just prefer
> > them myself, especially for Javascript problems that require single quotes.
> >
> > In the meantime, I packaged up the validifying functions in a class so
> there
> > shouldn't me any more conflicts.  Version 0.7 also includes a knocked up
> output
> > page which will open on request or if an unfixable error comes up.  It
> needs a
> > little work to pretty print the input and output if there is too long, and
> uses
> > 'xmp' tags which are deprecated (ironic, huh?), but it's a start.
> >
> > Take a look, test it to destruction!  (Remember it doesn't do attributes
> yet -
> > am concentrating on whole tags first....)  Would especially appreciate
> testing
> > against latest or recent CVS builds.
> >
> > http://www.jamietalbot.com/wp-hacks/xvalid.zip
> >
> > Source at:
> >
> > http://www.jamietalbot.com/wp-hacks/xvalid.phps
> >
> > Cheers,
> >
> > Jamie.
> >
> > --
> > http://www.jamietalbot.com/
> >
> >
> >
> >
> > Quoting "Eric A. Meyer" <eric at meyerweb.com>:
> >
> > > At 10:33 +0200 8/17/04, Brian Meidell wrote:
> > >
> > > >Since inconsistent use of double and single quotes in a XHTML
> > > >document seems to pass right through the w3 validator, I figured the
> > > >XML and XHTML spec might differ in other points as well.
> > >
> > >     Whatever XML defines is true for XHTML[1], because XHTML is XML.
> > > You can use either single quote or double quotes, but you can't leave
> > > quotes off of attribute values.  You also have to balance quotes;
> > > that is, if you open an attribute value with a double quote, it has
> > > to end with a double quote.  Similarly for single quotes.  I think
> > > those are the only rules regarding quotes on attribute values;
> > > they're the only ones I can remember offhand, anyway.
> > >
> > >
> > > [1] Although not necessarily for browser implementations of XHTML
> support.
> > >
> > > --
> > > Eric A. Meyer  (eric at meyerweb.com)    http://www.meyerweb.com/eric/
> > > Principal, Complex Spiral Consulting  http://www.complexspiral.com/
> > > "CSS: The Definitive Guide," "CSS2.0 Programmer's Reference,"
> > > "Eric Meyer on CSS," and more   http://www.meyerweb.com/eric/books/
> > >
> > > _______________________________________________
> > > hackers mailing list
> > > hackers at wordpress.org
> > > http://wordpress.org/mailman/listinfo/hackers_wordpress.org
> > >
> >
> > _______________________________________________
> > hackers mailing list
> > hackers at wordpress.org
> > http://wordpress.org/mailman/listinfo/hackers_wordpress.org
> >
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>




More information about the hackers mailing list