Forum OpenACS Q&A: tDOM abstraction procs

Collapse
Posted by Nick Carroll on
Hi,

I'm trying to create SOAP messages using tDOM, and would like to construct the SOAP message as a DOM object.  Looking at the xml procs in packages/acs-tcl/tcl/30-xml-utils-procs.tcl, I am confused as to which procs I should use for creating and manipulating xml.  As well as ones for using XPath queries.

Could someone point me to the procs that I should be focusing on?  I've looked at the XML-RPC package, and it looks like that package only uses procs to parse an XML document, rather than create one.

Thanks,
Nick.

Collapse
2: Re: tDOM abstraction procs (response to 1)
Posted by Rocael Hernández Rizzardini on
mostly all the wrappers at 30-xml are for parsing, those are used in several packages, like acs-auth, ims-ent, etc. For generating xml there are no procs yet, AFAIK, though tDOM can generate xml as well, but since the generation of xml is something more easy than parsing I think nobody has bothered to try it with tDOM.
Collapse
3: Re: tDOM abstraction procs (response to 1)
Posted by Nick Carroll on
Well the reason I want to use the OpenACS xml abstraction procs is so that my code doesn't become dependent on tDOM.  I see value in having the wrapper procs for generating xml.  I'm surprised XML-RPC doesn't generate XML with tDOM.  It looks like it just creates the XML from hard coded strings.
Collapse
4: Re: tDOM abstraction procs (response to 3)
Posted by Eduardo Pérez on
<blockquote> I see value in having the wrapper procs for generating xml.
</blockquote>
What's the value you see in there?

<blockquote> I'm surprised XML-RPC doesn't generate XML with tDOM.
It looks like it just creates the XML from hard coded strings.
</blockquote>
I just saw it. Scary, isn't it?

Collapse
5: Re: tDOM abstraction procs (response to 4)
Posted by Nick Carroll on
The wrapper procs for parsing XML were initially written so that if the underlying XML parser were to change, then all the packages that depend on that parser would break.  Having the wrapper procs means you are creating a layer of abstraction, whereby if the XML parser changes, then you just need to change the binding code in one place as oppose to several places in different packages.
Collapse
6: Re: tDOM abstraction procs (response to 1)
Posted by Andrew Grumet on
Mildly offtopic, I have a bit of recent experience using tdom to build XML documents.  If you decide to write your own wrappers, and haven't figured this stuff out yet, I found these commands helpful: dom createDocument, domDoc createElement, domNode setAttribute, domNode appendChild, domDoc asXML.

http://www.tdom.org/dom.html
http://www.tdom.org/domDoc.html
http://www.tdom.org/domNode.html

Here's some sample code:

http://grumet.net/writing/programmer/openacs/rsstv-feed-procs.tcl.txt

Collapse
7: Re: tDOM abstraction procs (response to 1)
Posted by Genevieve Cuevas on
I was able to use TclSoap to make SOAP calls to the google interface.  I copied all the tclsoap packages into the the acs tcl directory and removed all the package require statements.  I just had to figure out the order the files needed to be loaded in.