[scribus] Python scripting on XML recursive action

Cédric GEMY radar.map35 at free.fr
Fri Oct 1 20:26:53 CEST 2010

Lo all

i've made a config file looking like this :

<?xml version="1.0" encoding="UTF-8"?>
<SCRIBUSUTF8NEW Version="1.5.0.svn">
<Document isMaster="yes">
<Document isMaster="no">
<Document isMaster="no">

it refers to some scribus files.
I'm trying to load each of these file and and extract the line
<Section Number="0" Name="0" From="0" To="0" Type="Type_1_2_3" Start="20"
Reversed="0" Active="1"/>

to replace the Start value with the right one, taking care of the real number of
pages for each file.

My problem is that i can extract the value for the first but nothing shows for
the other. Here the code part related to this :

book = etree.parse("/home/cedric/.scribus/plugins/book.sla.book")
		URI = book.xpath('//URI')
		for doc in URI:
			tree = etree.parse(doc.text)
			for element in tree.iter("Section"):
				attrib_value = element.get('Start')
				setText("Section : "+URI[i].text+" "+str(attrib_value),"frame3") #just a
frame to control what it gets

it might be a simple lopp trouble, but i can't see it. May be some of you will.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scribus_lxml.py
Type: text/x-python
Size: 4027 bytes
Desc: not available
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20101001/53263e65/attachment.py>

More information about the scribus mailing list