2009-10-29 8 views
2

Le code ci-dessous:FBML et erreur HTMLParser

<html xmlns="http://www.w3.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> 

Résultats dans l'erreur suivante:

- 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"] 

Pourtant, la structure me semble valide ...

Répondre

2

Vous ne pouvez pas placer de balises à l'intérieur d'une balise <script>, et l'analyseur ZPT strict s'en plaint. Vous devrez en quelque sorte échapper au contenu, comme avec une structure tal: content = "structure string:":

<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> 
0

La balise script ne doit pas contenir du xml à ma connaissance.

Vous pouvez inclure le contenu dans les commentaires XML et voir si cela fonctionne.

Questions connexes