[wp-hackers] XHTML Strict Mode

Jamie Talbot wphackers at jamietalbot.com
Mon Aug 9 13:16:50 UTC 2004


Brian Meidell wrote <brian at mindflow.dk>:
>
>
> Jamie Talbot wrote:
>
> >Just shows how complicated it can get, eh?!  Your balanceTags is doing a
> great
> >job, but I'm quite taken with the idea of a full XHTML corrector.  Looked
> >around on the web and couldn't find anything, so it's obviously a huge
> >challenge and possibly not worth the effort!
> >
> >
> I take it you aren't talking about a validator, but something that
> rewrites markup to valid XHTML?
> Using a standard XML parser on the content with a modified XHTML DTD
> (that allows the html, body, head, title tags to be missing) should find
> any errors that might be, but actually guessing what the user intended
> to do is probably challenging.
> Is that what you are planning to do?
>

Yeah, kind of.  I acknowledge that this is an exercise in futility, but I'm
quite interested to see what can be achieved!  Perhaps one solution would be to
just close tags where they definitely can't contain the following tags? 
Basically, closing each tag as late as is legally possible.

For example < b>some text < div>Something< /div>

should recognise that a div, as a block element, cannot be inside a 'b' element
and thus should close the 'b' before it.

However < div>some text < b>Something< /b>

should close the div after the 'b', as 'b' elements are valid inside divs.

Of course < b>< i>something < /b>

should obviously be closed inside.

Looking at HTML Tidy at the moment and currently toying around with an idea that
might make this all possible, but unsure of how the results will come out!  If
anything useful comes out of, I'll post it!

Jamie.

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

> /Brian
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>




More information about the hackers mailing list