|
|
| version 1.1.1.1, 2004/02/04 10:03:33 | version 1.4, 2004/09/01 09:35:12 |
|---|---|
| Line 15 from Ft.Xml.XLink import XLinkElements | Line 15 from Ft.Xml.XLink import XLinkElements |
| #from Ft.Xml import EMPTY_NAMESPACE | #from Ft.Xml import EMPTY_NAMESPACE |
| from Ft.Lib import Uri | from Ft.Lib import Uri |
| xml2html={'WEB_normal':('<p>','</p>'),'Normal':('<p>','</p>'),'WEB_picture':('<p>','</p>'),'WEB_figuretitle':('<i>','</i>'),'WEB_bibliography':('<p><i>','</i></p>'),'Web_kursiv':('<i>','</i>'),'WEB_kursiv':('<i>','</i>'),'WEB_hyperlink':('','')} | xml2html={'WEB_normal':('<p>','</p>'),'Normal':('<p>','</p>'),'WEB_picture':('<p>','</p>'),'WEB_figuretitle':('<i>','</i>'),'WEB_bibliography':('<p><i>','</i></p>'),'Web_kursiv':('<i>','</i>'),'WEB_kursiv':('<i>','</i>'),'WEB_hyperlink':('',''),'Hyperlink':('','')} |
| def addToDict(dict,name,value): | def addToDict(dict,name,value): |
| if name=="": | if name=="": |
| Line 53 def proj2hash(xmlstring): | Line 53 def proj2hash(xmlstring): |
| sec=parseSection(section) | sec=parseSection(section) |
| if sec[0]=="WEB_project_header": # Sonderfall project | if sec[0]=="WEB_project_header": # Sonderfall project |
| addToDict(list,'WEB_project_header',sec[1]) # store title | addToDict(list,'WEB_project_header',sec[1]) # store title |
| addToDict(list,'WEB_project_description',sec[2]) #store description | addToDict(list,'WEB_project_description',sec[2]) #store description |
| else: # no information in heading | else: # no information in heading |
| addToDict(list,sec[0],sec[2]) | addToDict(list,sec[0],sec[2]) |
| #evaluate higher level sections | #evaluate higher level sections |
| Line 76 def proj2hash(xmlstring): | Line 78 def proj2hash(xmlstring): |
| def parseSection(section): | def parseSection(section): |
| heading=section.getElementsByTagName('heading')[0] | type="" |
| header="" | |
| for heading in section.childNodes: | |
| if getattr(heading,'tagName','')=="heading": | |
| type=heading.getAttribute('class') | type=heading.getAttribute('class') |
| header=getText(heading.childNodes) | 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 | #print section.childNodes |
| pars=Evaluate('par',section) | pars=Evaluate('par',section) |
| content=par2html(pars) | content=par2html(pars) |
| Line 165 def getText(nodelist): | Line 177 def getText(nodelist): |
| rc = u'' | rc = u'' |
| for node in nodelist: | for node in nodelist: |
| print "HHHH" | |
| if node.nodeType == node.TEXT_NODE: | if node.nodeType == node.TEXT_NODE: |
| #print "node",node | #print "node",node |
| #print "NODE",node.data.encode('utf-8','ignore'),"V" | #print "NODE",node.data.encode('utf-8','ignore'),"V" |
| #print "HALII" | #print "HALII" |
| try: | try: |
| try: | try: |
| print "try1" | |
| #rc += node.data.encode('utf-8','ignore') | #rc += node.data.encode('utf-8','ignore') |
| rc += node.data | rc += node.data |
| except: | except: |
| print "try2" | |
| #rc= node.data.encode('utf-8','ignore') | #rc= node.data.encode('utf-8','ignore') |
| rc=node.data | rc=node.data |
| except: | except: |
| Line 187 def getText(nodelist): | Line 196 def getText(nodelist): |
| node.data.encode('utf-8','ignore') | node.data.encode('utf-8','ignore') |
| #print "RC",rc | #print "RC",rc |
| elif node.tagName =="inline": | elif node.tagName =="inline": |
| print "HI", node.getAttribute('class') | |
| rc+=par2html([node]) | rc+=par2html([node]) |
| elif node.attributes: | elif node.attributes: |
| print "xlink?" | |
| if 'xlink:type' in node.attributes.keys(): #is a xlink? | if 'xlink:type' in node.attributes.keys(): #is a xlink? |
| rc +=xlink2html(node) | rc +=xlink2html(node) |
| #print "RWT",rc | #print "RWT",rc |