Tree tag and xmlDocument
Hi all, Scenario: I have an xmlDocument that has contents similar to these <?xml version="1.0"?> <document name="DS iibk3.doc"> <header level="1" htext="Aims"> <p>Paragraph 1</p> </header> <header level="1" htext="Learning objectives"> <header level="2" htext="Clinical Immunology"> <ul> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> </ul> </header> <header level="2" htext="Assessments"> <p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p> <p>Paragraph 4</p> <p>Paragraph 5</p> <p>Paragraph 6</p> </header> </header> </document> I would like this to be rendered to a tree structure. No problem <dtml-tree test_xml> <dtml-var getTagName> </dtml-tree> Show's a tree of the tagnames, (easy enough to change what is shown for each tag). However I only want the <header>'s to show up in the tree, at the moment all of the items are being rendered in the tree. Any Ideas. Phil phil@philh.org
At 04:02 PM 10/6/99 +0100, Phil Harris wrote:
<dtml-tree test_xml> <dtml-var getTagName> </dtml-tree>
Show's a tree of the tagnames, (easy enough to change what is shown for each tag).
However I only want the <header>'s to show up in the tree, at the moment all of the items are being rendered in the tree.
Any Ideas.
try using: <dtml-tree test_xml branches_expr="someDOMexprtosearchfortagslike('header')"> Where 'someDOMexprtosearchfortagslike('header')' should be changed to the appropriate XML DOM expression to be called on each tag that will return a list of subtags whose type is 'header'. :)
At 11:14 AM 10/6/99 -0500, Phillip J. Eby wrote:
At 04:02 PM 10/6/99 +0100, Phil Harris wrote:
<dtml-tree test_xml> <dtml-var getTagName> </dtml-tree>
Show's a tree of the tagnames, (easy enough to change what is shown for each tag).
However I only want the <header>'s to show up in the tree, at the moment all of the items are being rendered in the tree.
Any Ideas.
try using:
<dtml-tree test_xml branches_expr="someDOMexprtosearchfortagslike('header')">
Where 'someDOMexprtosearchfortagslike('header')' should be changed to the appropriate XML DOM expression to be called on each tag that will return a list of subtags whose type is 'header'. :)
Which would be "objectValues('header')". -Amos P.S. XML Documents are more similar to standard Zope objects than your might think ;-) P.P.S. XML Document comes with a README.txt Check it out, especially the "ObjectManager API support" section.
Amos, I'm sure I tried that with no joy but the stuff is at my workplace right now. I'll try again in the morning, and let you know. Phil phil@philh.org -----Original Message----- From: Amos Latteier [mailto:amos@aracnet.com] Sent: 06 October 1999 21:39 To: Phillip J. Eby Cc: zope@zope.org; Phil Harris Subject: Re: [Zope] Tree tag and xmlDocument At 11:14 AM 10/6/99 -0500, Phillip J. Eby wrote:
At 04:02 PM 10/6/99 +0100, Phil Harris wrote:
<dtml-tree test_xml> <dtml-var getTagName> </dtml-tree>
Show's a tree of the tagnames, (easy enough to change what is shown for
each
tag).
However I only want the <header>'s to show up in the tree, at the moment all of the items are being rendered in the tree.
Any Ideas.
try using:
<dtml-tree test_xml branches_expr="someDOMexprtosearchfortagslike('header')">
Where 'someDOMexprtosearchfortagslike('header')' should be changed to the appropriate XML DOM expression to be called on each tag that will return a list of subtags whose type is 'header'. :)
Which would be "objectValues('header')". -Amos P.S. XML Documents are more similar to standard Zope objects than your might think ;-) P.P.S. XML Document comes with a README.txt Check it out, especially the "ObjectManager API support" section.
Hi Phil I tried just that, <dtml-var test_xml branches_expr="getElementsByTagName('header')"> -- returns nothing <dtml-var test_xml branches_expr="getTagName() == 'header'"> -- returns nothing And also a few others, all return nothing, that is an empty tree. I also tried <dtml-var test_xml leaves="blank"> where blank is a dtmlMethod that returns nothing, but that still returned the leaves, go figure? Anyway thanks for responding. Phil phil@philh.org -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Phillip J. Eby Sent: 06 October 1999 17:14 To: Phil Harris; zope@zope.org Subject: Re: [Zope] Tree tag and xmlDocument At 04:02 PM 10/6/99 +0100, Phil Harris wrote:
<dtml-tree test_xml> <dtml-var getTagName> </dtml-tree>
Show's a tree of the tagnames, (easy enough to change what is shown for
each
tag).
However I only want the <header>'s to show up in the tree, at the moment all of the items are being rendered in the tree.
Any Ideas.
try using: <dtml-tree test_xml branches_expr="someDOMexprtosearchfortagslike('header')"> Where 'someDOMexprtosearchfortagslike('header')' should be changed to the appropriate XML DOM expression to be called on each tag that will return a list of subtags whose type is 'header'. :) _______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope (Related lists - please, no cross posts or HTML encoding! To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Amos Latteier -
Phil Harris -
Phillip J. Eby