--- MPIWGWeb/xmlhelper.py 2004/02/04 10:03:33 1.1 +++ MPIWGWeb/xmlhelper.py 2004/08/11 13:02:04 1.3 @@ -15,7 +15,7 @@ from Ft.Xml.XLink import XLinkElements #from Ft.Xml import EMPTY_NAMESPACE from Ft.Lib import Uri -xml2html={'WEB_normal':('

','

'),'Normal':('

','

'),'WEB_picture':('

','

'),'WEB_figuretitle':('',''),'WEB_bibliography':('

','

'),'Web_kursiv':('',''),'WEB_kursiv':('',''),'WEB_hyperlink':('','')} +xml2html={'WEB_normal':('

','

'),'Normal':('

','

'),'WEB_picture':('

','

'),'WEB_figuretitle':('',''),'WEB_bibliography':('

','

'),'Web_kursiv':('',''),'WEB_kursiv':('',''),'WEB_hyperlink':('',''),'Hyperlink':('','')} def addToDict(dict,name,value): if name=="": @@ -76,9 +76,17 @@ def proj2hash(xmlstring): def parseSection(section): - heading=section.getElementsByTagName('heading')[0] - type=heading.getAttribute('class') - header=getText(heading.childNodes) + type="" + header="" + for heading in section.getElementsByTagName('heading'): + type=heading.getAttribute('class') + header=getText(heading.childNodes) + + if type=="": # falls heading fehlt, pruefe ob erster par richtig + par=section.getElementsByTagName('par')[0] + type=par.getAttribute('class') + header=getText(par.childNodes) + #print section.childNodes pars=Evaluate('par',section) content=par2html(pars) @@ -165,19 +173,16 @@ def getText(nodelist): rc = u'' for node in nodelist: - print "HHHH" if node.nodeType == node.TEXT_NODE: #print "node",node #print "NODE",node.data.encode('utf-8','ignore'),"V" #print "HALII" try: try: - print "try1" #rc += node.data.encode('utf-8','ignore') rc += node.data except: - print "try2" #rc= node.data.encode('utf-8','ignore') rc=node.data except: @@ -187,10 +192,9 @@ def getText(nodelist): node.data.encode('utf-8','ignore') #print "RC",rc elif node.tagName =="inline": - print "HI", node.getAttribute('class') rc+=par2html([node]) elif node.attributes: - print "xlink?" + if 'xlink:type' in node.attributes.keys(): #is a xlink? rc +=xlink2html(node) #print "RWT",rc