[Zope] XMLDocument Question

James W. Howe jwh@allencreek.com
Fri, 04 Feb 2000 00:03:00 -0500


I'm doing some playing around XMLDocument objects.  I'm experimenting with 
using them to hold archive information.  I've successfully added an 
XMLDocument and built a ZCatalog to provide searching of the 
document.  However, I've run across something which I don't know how to 
handle.  Using the "Creating XML Applications With Zope" article as a base, 
if I have some XML which looks something like this:

<faq>
    <entry>
        <question>To be or not to be?</question>
        <answer>That is the question</answer>
    </entry>
</faq>

I can search for information pertaining to the "question" tag and display 
the question value by doing something like this:

<dtml-var "text_content('question')">

However, if my XML changes to look like this:

<faq>
    <entry>
       <question><p>To be or not to be?</p></question>
       <answer><p>That is the question</p></answer>
    </entry>
</faq>

and I use the code given above to reference the content of question, I get 
nothing.  I understand why this happens.  The text I want is contained in 
<p> tags and the <question> tag only knows that it contains the <p>.  What 
I want to be able to do is ask the XML document to give me all of its 
contents.  So, in the case above, I would want to get back the value:

<p>To be or not to be?</p>

Is there a way to ask a node of an XML document to return a textual 
representation of the entire contents of the particular node?

Thanks.

James Howe			internet: mailto:jwh@allencreek.com
Allen Creek Software, Inc.        pgpkey: 
http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI  48103