|
From: Lee T. <lee...@pl...> - 2001-05-08 22:44:23
|
here's the source: http://www.placemark.com/~lee/ns_tcldom.tar.gz just untar it into your aolserver source tree, or set NS_HOME in the Makefile to the location of your source tree. here's what we had to change: of course the Makefile to work with aolserver modules, etc. (didn't have to, but it made it so much nicer...) the following lines in tcldompro.c were added/replaced: --------------------------------------------- #include "ns.h" ... int Ns_ModuleInit(char *hServer, char *hModule) { /* AOLserver doesn't deal well with namespaces in C modules * so we need to reinitialize this module everytime a new * interp thread is created by AOLserver. */ Ns_TclRegisterAtCreate ( tcldominit, NULL); return (Ns_TclInitInterps(hServer, tcldominit, NULL)); } ///// in tcldominit: static int tcldominit( Tcl_Interp *interp, void *context ) .... //return Tcl_PkgProvide(interp, PACKAGE_NAME, VERSION); return NS_OK; --------------------------------------------- If you run through the code, you may notice a few other small differences, but the big one was "Ns_ModuleInit". The pain in the neck was figuring out that we had to use "Ns_TclRegisterAtCreate" to make it reload the commands with every thread. This isn't loading the file, it's just calling "Tcl_CreateObjCommand" a few times with every thread. Note: this isn't done, I'm writing this mailing list because we're having problems with it. Hopefully this will be of some use to someone, or maybe it'll help someone help us with this problem. BIG thanks to Jeremy Collins for making this work. - Lee Teague ----- In reply to "Re: [Tclxml-users] tcldompro.c" from Dave Bauer <da...@ki...> ----- > Wow, > > I am very interested in an AOLserver module with TclDOM. Do you mind sharing > the code or how you accomplished this feat? > > Right now we are using ns_xml with is a AOLserver module using libxml2 for > OpenACS, but the interface is very basic. TclDOM has a really nice interface > on the other hand, but the TCL version is slow. > Thanks > > Dave Bauer > da...@th... > > ----- Original Message ----- > From: "Lee Teague" <lee...@pl...> > To: <tcl...@li...> > Sent: Tuesday, May 08, 2001 3:50 PM > Subject: [Tclxml-users] tcldompro.c > > > > Hi - > > > > I've been working with your tcldom package, and I'm impressed! The tcl > xml > > parser seemed a little slow with large arrays (85 elements) so I've been > looking > > into the C version (tcldompro.c). I've got it compiled as an AOLServer > module, > > and it seemed to be working fine (we had a little trouble getting it to > compile > > with namespaces, but we figured it out. I'll send you a patch if you > want), but > > I do have a question: Does dom::DOMImplementation behave differently with > the C > > version? Here's what I'm trying to do: > > > > > > with the tcl version: > > > > %set doc [dom::DOMImplementation create] > > ::dom::document1(node1) > > > > the C version: > > > > %set doc [dom::DOMImplementation create] > > node9 > > > > > > with the tcl version, I can then take $doc and run "dom::DOMImplementation > > serialize" on it to create the xml. But, with the C version, it says, > "document > > has no document element" > > > > Also, with the TCL version, doing a "namespace eval ::dom { info vars }" > gives > > me "document1" (the array in the above case) and "document1var1", etc. > The C > > version does not. > > > > Thanks for *any* light you can shed on this. > > > > > > > > Lee Teague > > > > > > -- > > Lee Teague > > Placemark Investments > > lee...@pl... > > > > _______________________________________________ > > Tclxml-users mailing list > > Tcl...@li... > > http://lists.sourceforge.net/lists/listinfo/tclxml-users > > > > -- Lee Teague Placemark Investments 972.404.8100x31 | lee...@pl... |