SQL stored proc returns XML text; how to display in ZPT?
Hello everyone, I'm certain I'm missing something trivial, but it's getting late and I'm just about brain dead... I've got a SQL stored procedure that returns an XML string. I've written a ZSQL Method "dump_xml" that calls the stored proc; when I test it I get the XML string (although the formatting gets messed up when the browser tries to display it). There's no parameters passed to "dump_xml". How do I get Zope to return the XML data in a page? WIthin a ZPT page, I've tried: <span tal:replace="here/dump_xml" /> This returns something like <Shared.DC.ZRDB.Results.Results instance at 0x9001394>. Obviously I can see dump_xml based on this error message; I'm just trying to render the wrong thing. <span tal:replace="here/dump_xml()" /> This returns a key error What am I doing wrong? I'll happily use DTML, if anyone can give a solution. I just want to get this XML page published and go home! Thanks in advance Dave M.
David Mitchell wrote at 2003-11-12 22:58 +1100:
... I've got a SQL stored procedure that returns an XML string. I've written a ZSQL Method "dump_xml" that calls the stored proc; ... <span tal:replace="here/dump_xml" /> This returns something like <Shared.DC.ZRDB.Results.Results instance at 0x9001394>
This ("Shared.DC.ZRDB.Results.Results") is the result type of Z SQL Methods. It behaves like a sequence of "record" objects. A "record" provides access to the columns either by name or by index. Thus, you can use (e.g.): <XXX tal:define="result_sequence here/dump_xml" tal:replace="python: result_sequence[0][0]" /> This would render field "0" of the row "0" of your Z SQL Method result. -- Dieter
participants (2)
-
David Mitchell -
Dieter Maurer