[Zope-dev] Creating and adding Nodes in the XMLDocuments
Stephan Richter
srichter@cbu.edu
Fri, 14 Jan 2000 02:40:46 -0600
Hello Everyone,
Does someone knows XMLDocuments and DOM pretty well. Well then I have a
nut for you to crack:
Short Form:
I am implementing a little message board using XML documents. How can I
create Nodes, so I can add them to the document or are there other ways
to do it?
The Long Form:
For projects I do as living I alway keep all documentation in HTML and
XML. I also have a task list, with dates and status in XML form. Now I
thought it would be a good idea, if co-workers and clients could comment
on some of the task descriptions or write some updates about the tasks.
I thought that it would be great if this could be in the form of a small
Message Board saving all the comments in the same XML file for
completeness.
My XML will look something like this:
(There is actually more XML, but it is irrelevant to this case.)
...
<task ... >
<start>...</start>
<end>...</end>
<abstract>...</abstract>
<messages>
<message name="Subject">
<date>...</date>
<author>...</author>
<body>...</body>
<replies>
<message>....</message>
</replies>
</message>
...
</messages>
</task>
With the help of Zope, how can I add a single message into either the
'messages' or the 'replies' not using the Zope management interface and
only a programmable way.
Well I thought using acquisition I prepare the addMessage method in the
root folder of the XML document. Therefore I can reach it from every XML
node. I also do not have to worry then about passing the URL. Now I
have already the parent node for my message, making use of
absolute_url() and objectValues(). And I know there is a XML function
let me add another node.
MY PROBLEM: I do not know how to create a node or to add one simply to
the document. Is that really that hard?
Thank you guys for your great help and work.
Regards,
Stephan
--
Stephan Richter srichter@cbu.edu
CBU - Physics, Chemistry and Electrical Computer Engineering
Web2k - Technical Designs, Programming & Project Management