Subject: Can/Does/Should the FeedValidator catch improperly escaped XHTML?

From: "M. David Peterson" <[email-masked]>
Date: Wed, 30 Aug 2006 18:30:36 -0600

via
http://www.oreillynet.com/xml/blog/2006/08/and_the_winner_of_the_best_ind_1.html#comment-75533

There's one other small problem though: they put XHTML as CDATA in "html"
> text constructs, while they're supposed to contain HTML 4. And since it's
> XHTML, they should embed it directly in "xhtml" constructs...

Anthony brings out a good point >
http://www.oreillynet.com/xml/blog/2006/08/and_the_winner_of_the_best_ind_1.html#comment-75822<,

Odd that the validator isn't saying anything about this.

Should it, or is this an edge case that can be difficult, at best, to catch?

-- 
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354

---

From: Sam Ruby <[email-masked]>
Date: Thu, 31 Aug 2006 07:50:56 -0400

M. David Peterson wrote:
>     There's one other small problem though: they put XHTML as CDATA in
>     "html" text constructs, while they're supposed to contain HTML 4.
>     And since it's XHTML, they should embed it directly in "xhtml"
>     constructs...
> 

At the moment, the HTML content is passed through the following:

http://docs.python.org/lib/module-HTMLParser.html

Note that this parser includes a handle_startendtag method, which is not 
a part of the HTML standard.  Given the rather loose nature of HTML, 
this only tends to catch things like unmatched angle brackets and quotes.

Also, there are a number of tools that attempt to produce well-formed 
XHTML, but don't do so consistently enough to drop the content into an 
Atom feed in such a manner.

- Sam Ruby

---

From: "M. David Peterson" <[email-masked]>
Date: Thu, 31 Aug 2006 14:28:02 -0600

Thanks for the response/info Sam!

> Atom feed in such a manner.

I assume this is from an XHTML standpoint (meaning the result isn't a
one-to-one HTML > XHTML ~equivalent) and not an well formed XML standpoint?
Not that it really matters all that much as if the result isn't a solid
representation of the authors original intent, then theres really no other
alternative than to escape it and tag it as HTML.

In short, unless the above is incorrect, then both Anthony and the
FeedValidator are doing all that they both can and should be doing.

Is this a fair statement?

-- 
/M:D

M. David Peterson

---

From: Asbjørn Ulsberg <[email-masked]>
Date: Thu, 31 Aug 2006 22:57:59 +0200

> Atom feed in such a manner.

But is it possible to check the wellformedness of the markup inside  
atom:content and suggest that the authors use 'type="xhtml"' instead of  
'type="html"' if it is indeed wellformed X(HT)ML? It's a real stretch in  
terms of how far the validator should go, but I can definately see its  
usefulness.

-- 
Asbjørn Ulsberg     -=|=-    http://virtuelvis.com/quark/
«He's a loathsome offensive brute, yet I can't look away»

---

From: "James Holderness" <[email-masked]>
Date: Fri, 1 Sep 2006 00:19:35 +0100

> terms of how far the validator should go, but I can definately see its 

-1

Just because a feed appears to contain well-formed xhtml content today, that 
doesn't mean it's going to be well-formed tomorrow. Encouraging people to 
use xhtml when they don't know enough to have made that decision themselves 
is just asking for trouble. Sooner or later they're going to end up with 
broken xml which will be completely unreadable in many aggregators.

Also, escaped html tends to be better supported by aggregators anyway.

Regards
James

---

From: "A. Pagaltzis" <[email-masked]>
Date: Fri, 1 Sep 2006 02:01:54 +0200

* James Holderness <[email-masked]> [2006-09-01 01:30]:
> Encouraging people to use xhtml when they don't know enough to
> have made that decision themselves is just asking for trouble.

+1

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

---

From: "M. David Peterson" <[email-masked]>
Date: Thu, 31 Aug 2006 16:38:14 -0600

+1 - Definitely would be useful as a suggestion.

-- 
/M:D

M. David Peterson