Thu, 6 Mar 2003 20:41:22 -0500
On Thursday, March 6, 2003, at 04:17 PM, D. Rick Anderson wrote:
> Whoa .. ok. I was under the impression that Zope had built-in support
> for XML. If that's the case then I'll just send the data in CSV format.
> We have too many servers that will be pulling these reports and I want
> to keep the installed products down to a minimum.
I wrote an XML parser in Python that I've been using with good
results. It has public methods for locating nodes by tag, retrieving
content by tag, printing a tree of the DOM structure, and getting
child/parent/sibling nodes of any node. Since I'm mostly using it to
handle SOAP web services, there is also a simple way of getting the
name of the method invoked by the SOAP call.
Copy it to your Extensions folder; then it's just a matter of creating
an External Method to get the DOM object. From there, the code is
pretty simple. Here's an example:
lcXML = context.REQUEST['BODY']
loXML = context.xmlDOM(lcXML)
lcMethod = loXML.getSOAPMethodName()
lcLastName = loXML.contentByTag("lastname")
You can download xmlDOM.py from my website:
Please let me know if you have any problems or questions.