Hi all,
I am generating a string xml string from python and then passed to kid file
to display using XML() function.
I am getting problem in that.
The following sample code snippet is follows:
=============================
sample.py file:
===========
import kid
# x can be generated dynamically
# for example i have just hardcoded sample values.
x = [('foo', 'foo <- bar'), ('bar', 'baz <- bazzz')]
args['report'] = ''
for l in x:
args['report'] += '<tr><td>' + l[0] + l[1] + '</td></tr>'
page = kid.Template('/tmp/Foo.kid', args=args)
return page.serialize()
===========================================
Foo.kid File
=================================
<html xmlns:py="xmlns:py="http://purl.org/kid/ns#">
<body>
<table>
<tr><th>First row</th><th>Second Row</th></tr>
${XML(args['report'])}
<body>
</html>
===================================
I am getting the expat error:
===================================
ExpatError: Error parsing XML:
not well-formed (invalid token): line 1, column 19
=====================================
I found that why the expaterror occur. In my string has "<" symbol.
If i generate the table from my kid file itself, i didn't get any problem.
Its work fine.
The reason why i am generting from python itself, if my array content grows
, to load the page almost take 1 or 2 min. Thats y i generated from python
itself and then passed to kid file.
How do i escape the "<" symbol in XML function.
Please help me anyone.
Thanks in advance.
- Mahabub Basha.S
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss