English 中文(简体)
开放制图名称空间声明:与XMLNS或头版保持超文本?
原标题:Open Graph namespace declaration: HTML with XMLNS or head prefix?

I have seen conflicting information on how to best implement Open Graph namespaces. Specifically, the Open Graph website uses a few different methods, and the Facebook Open Graph examples use other methods.

开放图表网站实例(使用超文本预先定位特性):

<html prefix="og: http://ogp.me/ns#">

开放图表网站源代码(使用超文本XMLNS特性):

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">

Facebook的开放图表文件(利用欧洲开发协会的预先确定特征):

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">

Facebook 开放图表文件编号2(使用超文本XMLNS特性):

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" 
      xmlns:fb="https://www.facebook.com/2008/fbml">

What is the recommended method or does it not even matter?

最佳回答

它们都是同等的,所有工作都是一样的。

使用预设办法,因为它是新建议的方式,其性质也较少。

我拿到我们的所有文件,以便预先确定。

问题回答

我在Paul @ Tarjan的回答中试图用预先固定的头盔。 然而, 我谈一些因特网探索者8期。 因此,最后,我仍在使用轮椅法进行假名空间:

<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
  <head prefix="og: http://ogp.me/ns# object: http://ogp.me/ns/object#">

即便如此。 recognizesog,作为广泛使用的词汇:

RDFa的用户可以使用这些预设装置而不必在超文本代码中界定预设装置。 The same list of prefixes have also been defined for JSON-LD as a JSON-LD Context, at the URIcode>: http://www.w3.org/2008/json-ld-context/rdfa11; JSON-LD用户可使用@context 《世界投资倡议》作为使用同一前提的短手的关键。

重点进一步明确。

因此,不需要在你的超文本文件中增加一个名字空间。 http://stackoverflow.com/a/36229681/712334“>here

<html xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns# fb:
http://www.facebook.com/2008/fbml"> <head>

最好的验证方法。

prefix/xmlns attribute is useful to define short-hand. rdf is from xml lineage so xmlns notation should be expected to work independent of doctype detail. rdfa extends html with attributes including prefix as given by http://www.w3.org/TR/rdfa-in-html/#extensions-to-the-html5-syntax However, this requires adhering to http://dev.w3.org/html5/rdfa/rdfa-module.html Also, the tool support for rel="profile" as mentioned therein is as yet awaited. Till then, the choice is between using older doctypes, or manually placing rdf: for validation purpose or wait for validator & such tools to catch-up. The right place to make declaration is any element opening tag which is ancestor of wherever the short-hand notation will be used. Specifically for the case of og prefix, its predefined by the initial context of RDFa Core http://www.w3.org/2011/rdfa-context/rdfa-1.1.html so skipping it altogether for newer doctypes is alright. And specifically for html5 the RDFa initial context http://www.w3.org/2011/rdfa-context/html-rdfa-1.1 is loaded only after the RDFa initial context mentioned earlier.





相关问题
How can I match the xmlns:* attributes with XSLT?

How can I match the xmlns:* attributes with XSLT 1.0 ? Using a RDF document I tried: <xs:template match="rdf:RDF"> (...) <xsl:for-each select="@*"> <xsl:value-of select="."/> </...

Can find descendants using LINQ to XML or XPath Extensions

Anyone knows the problem why linq to xml or xpath extensions cant seem to read this xml? http://www.quillarts.com/Test/product.xml var document = XDocument.Load(feedUrl); var xpathxml = from feed in ...

add namespace to a xml document in C#

I have the following xml <book> <chapter>this is a sample text</chapter> </book> and need to add a namespace to it to be like the one below <ns0:book xmlns:ns0="http:/...

RESTFUL WCF Remove all xmlns

I set my DataContracts namespace to "" which removed one namespace but I have to remove the other: xmlns:i="http://www.w3.org/2001/XMLSchema-instance" If theres no other way, how can I serialize ...

xml and namespace anomaly

What is the difference between the following pieces of xml? The reason I ask is that when I submit the xml to a BPEL process the first and second one work but the last one does not, what is going on? ...