Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'test,': 0.04; 'chunk': 0.07; 'question.': 0.16; 'insert': 0.19; 'figure': 0.21; 'trying': 0.21; 'tree.': 0.23; 'import': 0.28; 'message-id:@mail.gmail.com': 0.29; 'print': 0.29; 'dom': 0.30; 'thanks': 0.30; 'this.': 0.32; 'to:addr:python-list': 0.33; 'follows:': 0.34; 'received:209.85.212': 0.34; 'test': 0.34; 'curious': 0.34; 'skip:- 40': 0.35; 'received:google.com': 0.38; 'received:209.85': 0.38; 'to:addr:python.org': 0.39; 'below': 0.62; 'node': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=v+a57jR/iDdNNKN/PqEIrymh8hDyZ8IWFKK5QaLFH5E=; b=yE57v7To136JDKz48tMI4AsKRR/mCLGb/eW3TumUB8ODAKOohjB7wcPKfpU1oJYjGH U+iErEiG7JZt69O9LG1Vjtr/Lks9+7qkeFkHMJJ4r6QqfU+UyJgo6ol18Hs0sKUEBz6m 5LQ+GW/TUrprG7uCcYj6VPXcw20D6okMHVIiY= MIME-Version: 1.0 Date: Wed, 14 Sep 2011 13:16:41 -0700 Subject: libxml2dom quesiton From: bruce To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 79 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1316031404 news.xs4all.nl 2449 [2001:888:2000:d::a6]:51021 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:13285 Hi. Test question. Trying to see how to insert a test node into an existing dom tree. For the test, it has a TR/TD with a td[@class="foo"] that has an associated TR.. Trying to figure out how out how to insert a "
" around the tr/td in question... Curious as to how to accomplish this. Thoughts/pointers. thanks -------------------------- sample code/html chunk follows: import libxml2dom text is below tt = libxml2dom.parseString(text, html=1) t1path_=tt.xpath(t1path) aa=tt.createElement("
") print len(t1path_) for a in t1path_: tt.insertBefore(aa,None) print a.nodeName print a.toString() sys.exit() -------------------------------------------- s3== trying to get::