Error de FBML y HTMLParser
-
10-07-2019 - |
Pregunta
El siguiente código:
<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>
Resultados en el siguiente 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"]
Sin embargo, la estructura me parece válida ...
Solución
No puede poner etiquetas dentro de una etiqueta <script>
, y el estricto analizador ZPT se queja de eso. Tendrá que escapar de alguna manera del contenido, como con un tal: content = & Quot; estructura string: & Quot; construir:
<script type="text/fbml" tal:content="structure string:
<fb:connect-form action="http://127.0.0.1/post_invite"<
>/fb:connect-form<
"></script>
Otros consejos
La etiqueta del script no debe contener xml que yo sepa.
Puede incluir el contenido en comentarios xml y ver si eso funciona.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow