views:

1204

answers:

4

I'm trying to get my Facebook Connect code to validate, but it won't. I think the problem is that their xmlns page isn't loading. I have the code:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">

But http://www.facebook.com/2008/fbml isn't found. Does anyone have a copy of what it should be? Is there a different URL i should use?

+3  A: 

The XML namespace doesn't need to actually exist, they are just a way to qualify elements and attributes. If you're interested (this is unrelated to your issue), there is more about XML namespaces here

Facebook seems to have a pretty straightforward page setup here: FB Connect, and it's laid out step by step. Have you checked this out?

NSX
A: 

Facebook XHTML does not validate.

Jon Winstanley
+2  A: 

As already mentioned, the namespace URL is a red-herring. It's the DTD (as specified in the DOCTYPE) that is validated against.

If you really want to validate your pages that use XFBML, you will need to validate against a custom DTD. And, as far as I'm aware, Facebook don't publish a DTD for XFBML themselves, so you'll have to write one yourself (probably only for the elements/attributes that you're actually using).

It's not actually as tricky as it sounds; here's an A List Apart article on how to validate against a custom DTD.

Note also that messing around with your DOCTYPE declaration may do funny things with regards to knocking (older) browsers into quirks mode.

So you can get it to validate; it's just up to you whether it's worth the hassle.

chrismear
A: 

XFBML - why did they have to be different? Nobody will care enough to petition them on this until a couple years from now and then W3C will re-write their standard to include XFBML or Facebook will be forced to re-write in a more compatible format. Why not use ID's or rel attributes to make their script work? That would allow a 100% valid format that would play nice with all browsers and CMS out there. Maybe they were worried about blog pages without root access making FB-based scams?

Ryan

related questions