开发者

FBML and HTMLParser error

开发者 https://www.devze.com 2022-12-10 13:31 出处:网络
The below code: <html xmlns=\"http://www.w开发者_运维知识库3.org/1999/xhtml\" xmlns:fb=\"http://www.facebook.com/2008/fbml\"

The below code:

<html xmlns="http://www.w开发者_运维知识库3.org/1999/xhtml"
      xmlns:fb="http://www.facebook.com/2008/fbml"
      xml:lang="en" lang="en">
<head>
    <title>FB Test</title>  
</head>

<body>
    <a href="#" onclick="FB.Connect.inviteConnectUsers();">Test</a>
    <fb:serverfbml style="width: 350px;">  
        <script type="text/fbml">
            <fb:connect-form action="http://127.0.0.1/post_invite">     
            </fb:connect-form>
        </script>
    </fb:serverfbml>
</body>
</html>

Results in the following error:

   - Warning: Compilation failed
   - Warning: <class 'zope.tal.htmltalparser.NestingError'>: Open tags <html>, <body>, <fb:serverfbml>, <script> do not match close tag </fb:connect-form>, at line 16, column 4
PTRuntimeError: ['Compilation failed', u"<class 'zope.tal.htmltalparser.NestingError'>: Open tags <html>, <body>, <fb:serverfbml>, <script> do not match close tag </fb:connect-form>, at line 16, column 4"]

Yet the structure seems valid to me...


You can't put tags inside of a <script> tag, and the strict ZPT parser is complaining about that. You'll have to somehow escape the contents, like with a tal:content="structure string:" construct:

<script type="text/fbml" tal:content="structure string:
    &lt;fb:connect-form action=&quot;http://127.0.0.1/post_invite&quot;&lt;         
    &gt;/fb:connect-form&lt;
"></script>


The script tag must not contain xml to my knowledge.

You could enclose the contents in xml comments and see if that works.

0

精彩评论

暂无评论...
验证码 换一张
取 消