You are here: Re: Building document tree with cross-over tags « HTML « IT news, forums, messages
Re: Building document tree with cross-over tags

Posted by Jim Higson on 08/23/06 18:18

Abe Simpson wrote:

> Hi all,
>
> I am developing an HTML rendering app and now working on CSS
> implementation. I understand I need to build a document tree to be able to
> correctly implement CSS inheritance and contextual selectors. Now, a
> document
>
> ABC <B> DEF <I> GHI </i> KLM </B> NOP
>
> tranlates into a simple nice tree as every tag has a matching closing tag
> and there are no crossovers. But what do you do with something like this :
>
> ABC <B> DEF <I> GHI </B> KLM </I> NOP
>
> Note that the closing B tag is encounted before a closing I tag. This is
> still perfectly legal HTML, but how do you build a free out of that?

Personally, I'd just reject bad markup. If you must accept it, copy what the
main browsers do (you can use Mozilla's DOM inspector to see how they parse
it)

TagSoup (http://home.ccil.org/~cowan/XML/tagsoup/) is a good parser for bad
markup - maybe you can use that?

--
Jim

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация