1

I already add one fb xmlnx code like below, and now I wana add another one also.

<html xmlns:fb='http://www.facebook.com/2008/fbml'>

when I add like below, it shows error,

    <html 
xmlns:fb='http://www.facebook.com/2008/fbml'
xmlns:fb='http://ogp.me/ns/fb#'>

can anyone tell me how to add both codes???

pnuts
  • 58,317
  • 11
  • 87
  • 139
RJ Style
  • 111
  • 1
  • 2
  • 11
  • Try change namespace alias name: `xmlns:fb2='http://ogp.me/ns/fb#'` – Sergei Danielian Jun 28 '12 at 01:12
  • @gahcep xmlns:fb2='http://ogp.me/ns/fb#' xmlns:ofb='http://ogp.me/ns/fb#' both are not working, how could I change the name?? I need to approach two different links of "fb". – RJ Style Jun 28 '12 at 23:11
  • You could try an approach desribing in [XML Namespaces Explained](http://www.sitepoint.com/xml-namespaces-explained/) article. See **Defining the Same Prefix for Multiple Namespaces** section. – Sergei Danielian Jun 29 '12 at 01:01

1 Answers1

3

A General answer:

There is no way to "concatenate" namespaces, but you can give them different prefixes

    <html 
          xmlns:fb='http://www.facebook.com/2008/fbml'
          xmlns:og='http://ogp.me/ns/fb#'>

Then use fb:tag for facebook tags and og:tag for ogp.me tags

A specific answer:

The recommended use of Open Graph protocol is not via the xmlns attribute but via a prefix attribute ( http://ogp.me/ ) So the code that uses both, will look like this:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
      xmlns:fb="https://www.facebook.com/2008/fbml"> 
<head prefix="og: http://ogp.me/ns# [YOUR_APP_NAMESPACE]: 
                  http://ogp.me/ns/apps/[YOUR_APP_NAMESPACE]#">
  <meta property="fb:app_id" content="[YOUR_APP_ID]" /> 
  <meta property="og:type" content="[YOUR_APP_NAMESPACE]:recipe" /> 
  ...

Example courtesy of https://developers.facebook.com/docs/opengraph/tutorial/

anttix
  • 7,709
  • 1
  • 24
  • 25
  • xmlns:fb2='http://ogp.me/ns/fb#' xmlns:ofb='http://ogp.me/ns/fb#' both are not working, how could I change the name?? I need to approach two different links of "fb". – RJ Style Jun 28 '12 at 23:13
  • OG recommends using prefix attribute, look the updated answer – anttix Jun 28 '12 at 23:36