Date: 2004-09-15T21:21:10
Editor: TonyEdwards <[EMAIL PROTECTED]>
Wiki: Cocoon Wiki
Page: FlowBasedXMLEditor
URL: http://wiki.apache.org/cocoon/FlowBasedXMLEditor
no comment
Change Log:
------------------------------------------------------------------------------
@@ -35,6 +35,7 @@
To create a new document, pass the name of the document to the
'''newDocument''' function. Adding attributes is as simple as calling
'''addAttribute'''. If the nodeParent parameter is null, the attribute gets
assigned to the document root.
[[BR]]The use of the '''sessionManager''' is interesting.
[[BR]]I couldn't for the life of me get a reference to the DOM if I used the
'''cocoon.session''' object. I don't know why. I scoured all manner of places
and found the use of the sessionManager, stuck the document in there, and then
I was able to access the DOM from the pipeline. Maybe I missed something, but
it works.
+[[BR]]Some of the code is specific to my particular application but most of
what's in jsUtils.js is generic enough to be used in your own projects. Let me
know if you do and keep me informed of any improvements you make!!
[[BR]]
[[BR]] var sXmlName = "TestDoc";
[[BR]] var xmlDoc = newDocument("hierarchy","description",Trim(sXmlName));
@@ -42,7 +43,7 @@
[[BR]] addAttribute(xmlDoc,null,"hrcyNumber",0);
[[BR]] var sessionManager =
cocoon.getComponent("org.apache.cocoon.webapps.session.SessionManager");
[[BR]] var session = sessionManager.getSession(true);
-[[BR]] session.setAttribute("hrcyDoc", hrcyDoc);
+[[BR]] session.setAttribute("xmlDoc", xmlDoc);
[[BR]] cocoon.sendPage("tree-menu");
[[BR]]
[[BR]] The sitemap pipeline that process the evergrowing document looks like
this (note the name of the session attribute):