Nick Vargish <nav+posts at bandersnatch.org> wrote in news:87wtlbdfo4.fsf at localhost.localdomain: > I've been trying to figure out how to do something that seems > relatively simple, but it's just not coming together for me. I'm > hoping someone will deign to give me a little insight here. > > The problem: We have XML documents that use a custom table format > that was designed primarily for typesetting documents. It's a > column-first oriented scheme, and now we need a way to convert > these table elements to HTML style row-first tables. > > I would like to be able to do something like this: > > doc = xml.dom.minidom.parse(input) > for table in doc.getElementsByTagName('COLTABLE'): > newtable = coltable_to_rowtable(table) > ## this is what I can't figure out > doc.replace(table, newtable) > output.write(doc.toxml('utf-8')) > > I'm pretty sure I'm missing something obvious, but haven't been > able to find any examples. > > Someone please whack me with a cluestick, > > Nick > table.parentNode.replaceChild(newtable, table)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4