From a83800501411a5791d6827532855ebbdc7f6885e Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Fri, 15 Jan 2010 21:21:53 +0000 Subject: [PATCH] Adding a method to get a XEP's version. git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3838 4b5297f7-1745-476d-ba37-a9c6900126ab --- xepinfo.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xepinfo.py b/xepinfo.py index 844d6e32..54a72655 100644 --- a/xepinfo.py +++ b/xepinfo.py @@ -38,8 +38,12 @@ def getText(nodelist): return thisText class XEPInfo: - def __init__(self, filename): - thexep = parse(filename) + def __init__(self, filename, parseStr): + thexep = "" + if parseStr: + thexep = parseString(filename) + else: + thexep = parse(filename) xepNode = (thexep.getElementsByTagName("xep")[0]) headerNode = (xepNode.getElementsByTagName("header")[0]) titleNode = (headerNode.getElementsByTagName("title")[0]) @@ -51,7 +55,7 @@ class XEPInfo: self.status = getText(statusNode.childNodes) self.type = getText((headerNode.getElementsByTagName("type")[0]).childNodes) revNode = (headerNode.getElementsByTagName("revision")[0]) - version = getText((revNode.getElementsByTagName("version")[0]).childNodes) + self.version = getText((revNode.getElementsByTagName("version")[0]).childNodes) self.date = getText((revNode.getElementsByTagName("date")[0]).childNodes) def getNr(self): @@ -62,6 +66,9 @@ class XEPInfo: def getStatus(self): return self.status + + def getVersion(self): + return self.version def getType(self): return self.type