[Zope] XMLWidgets question
Ron Bickers
rbickers@logicetc.com
Mon, 15 May 2000 16:51:24 -0400
The best way to handle this is to create a widget for nodes of name '#text',
with a render widget of the following:
<dtml-var getNodeValue>
Change your <p> render method as you suggested:
<p><dtml-var render_helper></p>
Then, as the <p> node is traversed, it will render all element nodes within
the <p> as well as spit out any paragraph content (nodes with nodename of
#text).
See my DocBookDocument product (and specifically the DocBookWidgets/xw__TEXT
widget) for an example of this.
http://www.zope.org/Members/rbickers/DocBookDocument
Note that if you want the <table> element to render the same way in any
context, you can delete the isNodeSupported() method. It comes in handy if
you have mulitple widgets that handle the same <table> node in different
contexts.
_______________________
Ron Bickers
Logic Etc, Inc.
rbickers@logicetc.com
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Richard.Folwell@symbian.com
> Sent: Monday, May 15, 2000 7:30 AM
> To: zope@zope.org
> Subject: [Zope] XMLWidgets question
>
>
> I am trying to use XMLWidgets to render some simple structured
> documentation, and am running into problems extending it. The problem I
> have is with trying to add new elements that can be included in <p>
> elements. For example, I have created a new element <table>, which works
> OK if inserted into a section, but produces no output (and no errors) if
> placed into a paragraph.
>
> The isNodeSupported() method was changed to:
>
> <dtml-return "getParentNode().getNodeName() == 'section'" ||
> "getParentNode
> ().getNodeName() == 'p'">
>
> so that it will be legal in both contexts. I guess the problem
> is that the
> render() method for <p> is:
>
> <p><dtml-var text_content></p>
>
> which of course will not produce anything for contained elements. However
> changing it to:
>
> <p><dtml-var render_helper></p>
>
> will not work because it will never get to the point where it will extract
> the paragraph content to display (though it will now display contained
> elements).
>
> Am I going about this the wrong way, or am I just missing something
> obvious?