[Web-SIG] DOM Implementation
Shannon -jj Behrens
jjinux at gmail.com
Fri Jun 3 22:37:05 CEST 2005
Yeah, this is more along the idea that Paul Abrams had, as I mentioned
in my blog, leading me to bring up this subject. In his idea, he had
a piece of Python splicing together pieces of XML, and treating the
DOM somewhat like a dictionary where the ids where the keys.
On 6/3/05, Timothy Soehnlin <tsoehnli at gmu.edu> 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>
> <data id='updated'>
> <h2>Updated, click <a href='/admin/'>here</a> to return</h2>
> via the id tags, you could modify the output without ever knowing what it is.
> Assuming there is a wrapper around the xml file, to be indexed as a dictionary given 'id' tags,
> if you successfully deleted something, you would return as output, xmlObject['deleted'], and
> with string splicing, you could merge data, as with xmlObject['blogEntry'] % blogData, where
> blogData is a dictionary of data that could be generated by another xml file, or a database query.
> This would then would return a fully constructed html block, without the script ever knowing or
> touching any html.
> This orientation has some drawbacks, but allows for complete separation of code from
> This may happen to be too verbose for certain things, as it seems to add a lot of extra code
> for doing simple things, but with some simple coding, you could easily build a module that works
> around that.
> I do know that this works quite well for a system I have built, and keeps people who are editing
> the xml files from seeing any control structure, or any indication of python. Which means you
> could have people who know only html build the xml files, and then coders manipulate it, neither
> of the two would need to interact minus the definition of the variables for interpolation. Also, to
> hide python even more, the %( )s is normally replaced with [[ ]], as to make it seem more
> variable like, but that is superficial.
> I would rather be known as a Christian
> and despised, than to be overlooked,
> and thought of as one of the world.
> Web-SIG mailing list
> Web-SIG at python.org
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe: http://mail.python.org/mailman/options/web-sig/jjinux%40gmail.com
I have decided to switch to Gmail, but messages to my Yahoo account will
still get through.
More information about the Web-SIG