[xml] unlinking nodes leaves spaces



When running the following python script I get spaces left where nodes
have been removed.  What am I doing wrong?

TIA

import libxml2

x = libxml2.parseDoc("""\
<?xml version="1.0" standalone="yes"?>
<rhythmdb version="1.0">
  <entry type="song">
    <location>file:///home/stan/shared/file</location>
  </entry>
  <entry type="podcast-feed">
    <title>mm</title>
  </entry>    
  <entry type="song">
    <location>file:///home/stan/shared/file</location>
  </entry>
  <entry type="song">
    <location>file:///home/stan/tmp/file</location>
  </entry>
</rhythmdb>
""")
y = x.xpathEval("/rhythmdb/entry[ type='song']/location"
    "[starts-with(., 'file:///home/stan/shared/')]/parent::*")
for node in y:
    node.unlinkNode()
    node.freeNode()
x.saveFile("-")



Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]