[Ur] Howto make urweb generate invalid XHTML code?

Adam Chlipala adamc at impredicative.com
Sat Dec 11 20:02:31 EST 2010


Marc Weber wrote:
> Eg try this validator:
>
> http://validator.w3.org/check?uri=http%3A%2F%2Fmawercer.de%2F%7Emarc%2Ftest.html&charset=%28detect+automatically%29&doctype=Inline&group=0
>
> (The html file was generated and uploaded to my server previously)
>
> What's the issue?
>
> <ul></ul>
>
> without<li>  tags is not allowed according to XHTML.
>
> [...]
>
> So I don't consider this a being a bug of Ur - but of its documentation.
>    

Agreed.  This behavior is exactly what I was aiming for in designing a 
suitably simple but also useful set of XHTML constraints to check.  I've 
updated the manual with this additional text in the section on XML 
combinators:
> The Ur/Web standard library encodes a very loose version of XHTML, 
> where it is very easy to produce documents which are invalid XHTML, 
> but which still display properly in all major browsers.  The main 
> purposes of the invariants that are enforced are first, to provide 
> some documentation about the places where it would make sense to 
> insert XML fragments; and second, to rule out code injection attacks 
> and other abstraction violations related to HTML syntax.

Marc Weber wrote:
> The dtd says:
>
>    <!ELEMENT ul (li)+>
>
> which means an ul must contain one ore more li elements.
>
> [...]
>
> So in that case ur doesn't even validate nesting order of tags (which
> WASH showed that its possible easily)
>    

You're not seeing some deep technical limitation in Ur/Web, which _does_ 
check nesting order of tags in a 100% sound way.  Rather, I wasn't aware 
of this XHTML restriction when I wrote the types for the standard 
library's HTML tag combinators.  Such code displays well in all the 
major browsers, right?  I'm not sure it's worth changing, since that 
means more complicated types in the standard library.



More information about the Ur mailing list