[Dan Shafer]
I am fully aware of the horrendous overhead associated with XML documents but these documents are quite small (3-4 pages on average, printed) and always identically structured. With Python's excellent XML support, I have already gotten some very good routines written to parse such documents. My problem is that when I try to translate that code to Zope External Methods, they don't work and debugging them in Zope is a nightmare.
I am learning, and I am open to any suggestions or corrections to my thinking. I appreciate the group's patience with me and any ideas you have.
Dan, I do XML processing and xslt transformations using Python and external methods, and it works very well. Also, I don't think that XML necessarily incurs such "horrendous" overhead. The key to having it work well is, I think, to have one simple external method call to the python scripts that do all the work, and have them return strings or arrays to the DTML page for formatting. If you do an xslt transformation to produce a complete html page, all you need on the dtml page may be a single <dtml-var "yourMethod(....)"> This way, you can debug the python scripts like any other python code (that is, outside of Zope), and when it works, just call it from Zope. Make sure to keep your programs out of the Zope directory tree, and make them accessible by using a .pth file in the Zope bin directory (or wherever Zope's Python executable file ends up). Here is one complete page for processing a form, receiving XML from the form (stored in a hidden variable), sending it to an external python program via an external method, receiving and XML string back, and then transforming that to the final html page. # =================================================== <dtml-let xml="runSAERoute(_['REQUEST']['xml'],_['REQUEST']['live'][0])"> <dtml-let xsl="getBasepath()+'\\stylesheets\\routeInfoDisplay_4.xsl'"> <dtml-var "transform_xml_string (xml,xsl)"> </dtml-let> </dtml-let> # =================================================== You see how simple it is. I make one call to create the output XML (which we want for some other reasons that don't matter here), and one more to run an xslt transformation, for which I use 4xslt (but there are other possibilities). Here, runSAERoute(), getBasepath(), and transform_xml_string() are called via external methods. Those methods, though, just do simple function calls to the real code. runSAERoute() is actually about 1000 lines of Python code that lives outside the Zope directory tree. You can have the external code store data in the file system if you like - use a directory relative to the base module because you can always find its location programatically. (Yes, I know I hard-coded the path separators. Yes, I know it's better not to.) I don't see why something like this wouldn't work just fine for you. Cheers, Tom P