Erro fbml e htmlparser
-
10-07-2019 - |
Pergunta
O código abaixo:
<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>
Resulta no seguinte erro:
- 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"]
No entanto, a estrutura me parece válida ...
Solução
Você não pode colocar tags dentro de um <script>
TAG, e o rigoroso analisador Zpt está reclamando disso. Você terá que escapar de alguma forma o conteúdo, como com um tal: content = "String string:" Construct:
<script type="text/fbml" tal:content="structure string:
<fb:connect-form action="http://127.0.0.1/post_invite"<
>/fb:connect-form<
"></script>
Outras dicas
A tag de script não deve conter XML a meu conhecimento.
Você pode incluir o conteúdo nos comentários XML e ver se isso funciona.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow