Esempio n. 1
0
def make_nested(secs):
	root =None
	new={}
	for s in secs:
		ns=NmpmlObject({'tag':"Cell", 'attributes':s.attributes, 'elements':[], 'cdata':None})
		ns.data = s.getPoints()
		for e in s.elements:
			ns.newElement(e)
		if not s.parent():
			root = ns
		new[s.name()]=ns	
	for name in new:
		s = new[name]
		if s == root:
			continue
		p = s.attrib("Parent")
		del(s.attributes["Parent"])
		s.move(new[p])
	return root