1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 10:12:19 -05:00

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
This commit is contained in:
Tobias Markmann 2010-01-15 21:21:53 +00:00
parent 426268ad4d
commit a838005014

View File

@ -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