See reply below.

On 11/5/07, Robert . <[EMAIL PROTECTED]> wrote:
> On 11/5/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
> >
> > > It is true that in XML <div></div and <div/> are equivalent.
>
>
> Just to be clear, I meant to write that <div></div> and <div/> are
> equivalent in XML.
>
>
> However
> > > XHTML (at least 1.0) has some additional rules you have to take into
> > > account.
> > > In this case the next rule applies:
> > > "For non-empty elements, end tags are required"
> >
> > > http://www.w3.org/TR/xhtml1/#h-4.3
> > > Note that an element that is allowed to have a child node is always a
> > > non-empty element, even if this specific element instance has no
> > content.
> > > Therefore <div/> is invalid XHTML
> >
> > I don't believe that holds true. <div> (without closing tag) is
> > invalid XHTML. Because it's not well formed. There is certain
> > ambiguity in that section. I don't think <div> and <div/> are the same
> > thing. And I don't believe that if you use <div/> that means you've
> > ommited the end tag.
>
>
> It think the section is pretty clear. Please pay special attention to these
> two sentences:
> "All elements other than those declared in the DTD as EMPTY must have an end
> tag.
> Elements that are declared in the DTD as EMPTY can have an end tag *or* can
> use empty element shorthand"
Okay, I might have overlooked the *or* part with implicates that empty
element shorthand should not be used for non-empty elements.

Still this leaves us with 3 options.
a) ignore things silently and then support lot of weird bugreport of
user complaining that ajax is not working in firefox (because of the
messed up DOM tree)
b) fix the error for user (which is current behavior)
c) throw an exception or warn user somehow

Now given that <div/> might not actually be permitted in xhtml (though
I'm still not 100% convinced) option c) could be better alternative to
b), though I'd still insisted on doing it by default. However, we
would need then some kind of mechanism that would allow us to suppress
the behavior in case the document is actually an xml document and will
be served as xml document.

>
> See how they make the distinction between the end tag and the empty element
> shorthand? And they make the distinction between EMPTY and other elements.
> DIV is NOT declared as an EMPTY element (because it can have child nodes).
> Therefore it must have an end tag.
>
> Also all the examples in section show only open
> > tag, not open-close.
>
>
> Yes, the examples do not show this unfortunately.
>
>
> This was probably meant to make sure that people
> > don't follow the html practice of using just open tags.
>
>
> This is already covered by 4.1 http://www.w3.org/TR/xhtml1/#h-4.1
> "Essentially this means that all elements must either have closing tags or
> be written in a special form (as described below), and that all the elements
> must nest properly."
>
>
> XHTML files are valid XML documents, and disallowing <div/> tags would
> > be against it, as <tag></tag> and <tag/> are as far as I know
> > considered equal in xml.
>
>
> Equal in XML yes.
> And yes, XHTML files are valid XML documents. However not all XML documents
> are valid XHTML files, even when using XHTML tag names.
Which is kinda weird. I was under impression that as long as you stick
to the doctype (or xsd) all xml documents would be valid xhtml
documents.
>
>
> However, Internet explorer doesn't understand the application/xml
> > header, which means that we have to serve xhtml files with text/html.
> > And that makes firefox use the html parser, which considers <div/> an
> > open tag, even though it's not true.
>
>
> Yes, IE does not understand application/xml.
> And that is why I suspect that rule 4.3 exists. So that xhtml 1.0 could be
> server to IE, and the result would be equivalent as serving html 4.01.
Ironically, IE doesn't have any problem with empty elements such as <div/>.

-Matej
>
> Robert.
>

Reply via email to