changeset 416:1c821283556a

new getInfoFromPage to read multiple parameters at once
author casties
date Thu, 23 Dec 2010 17:45:55 +0100
parents b93a2e5d5506
children a7dc563103c7
files MpdlXmlTextServer.py
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MpdlXmlTextServer.py	Thu Dec 23 17:12:23 2010 +0100
+++ b/MpdlXmlTextServer.py	Thu Dec 23 17:45:55 2010 +0100
@@ -224,13 +224,25 @@
             dom = Parse(text)
             # figureEntries
             pagedivs = dom.xpath("//div[@class='countFigureEntries']")
-            docinfo['figureEntries'] = getTextFromNode(pagedivs[0])
+            s = getTextFromNode(pagedivs[0])
+            try:
+                docinfo['figureEntries'] = int(s)
+            except:
+                docinfo['figureEntries'] = 0
             # tocEntries
             pagedivs = dom.xpath("//div[@class='countTocEntries']")
-            docinfo['tocEntries'] = getTextFromNode(pagedivs[0])
+            s = getTextFromNode(pagedivs[0])
+            try:
+                docinfo['tocEntries'] = int(s)
+            except:
+                docinfo['tocEntries'] = 0
             # allPlaces
             pagedivs = dom.xpath("//div[@class='countPlaces']")
-            docinfo['allPlaces']= getTextFromNode(pagedivs[0])
+            s = getTextFromNode(pagedivs[0])
+            try:
+                docinfo['allPlaces'] = int(s)
+            except:
+                docinfo['allPlaces'] = 0
 
         return docinfo