FB 如何创建 FBML?
我对 FB 如何创建 FBML 以及如何创建类似的东西非常感兴趣。他们是否编写了一个 C++ 处理器来用 HTML 替换 FBML,或者他们是否使用 XSLT,或者他们做了什么来创建这样的模板语言?我想这样做主要是为了我自己的知识和业余时间的乐趣,看看我是否能够构建类似的东西。我尝试查找他们是如何制作的,但我得到的只是使用 FBML 的方法。
I am really interested in how FB created FBML and how to go about creating something similar. Did they write a C++ processor that replaces FBML with HTML or do they use XSLT or what did they do to create a templating language like that? I am wanting to do this mainly for my own knowledge and fun on my spare time to see if i am able to build something similar. Ive tried looking up how they made it but all I get is ways to use FBML.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果是 Facebook 应用,则 FF 或 IE 等浏览器将连接到
app.facebook.com/some_app
,Facebook 服务器将连接到www.foobar.com/blah< /code> (应用程序创建者向 Facebook 注册的)FBML 代码,Facebook 可以将其更改为任何它想要的内容 - 将 FBML 更改为 XHTML。他们可以使用解析器解析 FBML 代码,并将其相应地转换为 XHTML。
If it is a Facebook app, then a browser such as FF or IE connects to
app.facebook.com/some_app
, and the Facebook server will connect towww.foobar.com/blah
(which the app creator register with Facebook) for the FBML code, and Facebook can change it to whatever it wants -- changing the FBML into XHTML. They can use parsers to parse the FBML code, and convert it into XHTML accordingly.好吧,有 3 种方法可以编写将 XML 转换为 HTML 的解析器:
选项#1 基本上没有完成,因为您始终可以使用#2。
从某些标签需要与 XML 文件外部的资源通信(例如
fb:if-can-see
)这一事实来看,#2 和 #4 似乎比 #3 更有可能 - - 两者都可以更轻松地访问 SQL 数据库或 NoSQL 数据库等。(许多语言中的 XSLT 库允许定义自定义函数,这些函数可以使用它们所实现的语言访问任意数据源,因此#3 并非不可能)。
Well, there are 3 ways to write a parser for XML that converts to HTML:
Option #1 is bascially not done since you can always use #2 instead.
Judging from the the fact that some of the tags need to talk to resources outside of the XML file (e.g.
fb:if-can-see
), #2 and #4 seem more likely than #3 -- both would have easier access to SQL databases or NoSQL databases and the like.(The XSLT libraries in many languages allow one to define custom functions that can access arbitrary data sources in the language they are implemented, so #3 isn't impossible).