[Zope] libxml2 help

Gabriel Genellina gagenellina at softlab.com.ar
Mon Dec 22 23:02:01 EST 2003


At 22/12/2003 16:08, you wrote:

>I am trying to parse xml with libxml2.  I have DTML Docs in a Zcatalog
>that are xml formatted.  I am trying to use a python script to display
>the xmls using the xpath function of libxml2.  The problem I am having
>is that in the Results method I have this.
>
><dtml-var expr="parseXML(legal=getobject(data_record_id_))">
>
>the problem is that when the content of this variable gets sent
>to my parseXML python script all the xml tags get replaced with the html
>encoded versions of the tags ( ie. < and > get replaced with &lt; and
>&gt; ) I'm not calling the html_quote function so I don't understand why
>it is replacing the tags.

It's a bit confusing... A DTMLDocument is a template, how do you catalog 
it? If it's static, you could use a File object by example. Else, you are 
cataloging a *rendered* version of the template, but how do you restore it 
without having the original arguments? ZCatalog just stores a path or id.
Anyway, getobject() returns the cataloged object, your DTMLDocument, not a 
string. You surely are converting it to string somehow, maybe by calling it 
or by using str(). Try using read() or document_src() instead, maybe this 
is what you are looking for.


Gabriel Genellina
Softlab SRL




More information about the Zope mailing list