[Web-SIG] DOM Implementation

Phillip J. Eby pje at telecommunity.com
Fri Jun 3 23:22:31 CEST 2005

At 04:59 PM 6/3/2005 -0500, Timothy Soehnlin wrote:
>What if instead of intersplicing node commands, such as iterating through 
>lists, into
>  the actual document, you were to operate on a different idea.
>What if you were to parse an xml file, and then manipulate the entire
>  page as through a system of blocks. i.e.
>         <data id='eItem'>
>                 <div class='blogEntry'>
>                         <div class='heading'>%(heading)s</div>
>                         <div class='day'>%(day)s</div>
>                 </div>
>         </data>
>         <data id='updated'>
>                 <h2>Updated, click <a href='/admin/'>here</a> to return</h2>
>         </data>
>via the id tags, you could modify the output without ever knowing what it is.

PyMeld does something more or less like that.  However, it still produces 
an excess of coupling between code and presentation at a global scale in 
the document - while keeping all the drawbacks of a static document model.

Conceptually, this approach is like calling a function with a large number 
of arguments, and the number of arguments just gets bigger and bigger, and 
the function becomes more complex.

Approaches in the woven/PWT family let a document make several function 
calls, each with its own set of unique local parameters, so that you don't 
end up with one huge super-coupled function.

(PWT further refines this approach by making the sub-templates be functions 
themselves, as well as arguments, so that functions can be passed to 
functions, making the system extremely flexible while still barring any 
actual computation from occurring in the XML, or any XML -- including DOM 
manipulation -- from being needed in the Python parts.)

More information about the Web-SIG mailing list