From: Faiyaz Ahmed Date: Mon, 26 Jan 2009 19:53:13 +0000 (+0000) Subject: parse a string or a file. X-Git-Tag: sfa-0.9-0@14641~715 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=aee745798b84ec94dfbbbd611d7b9ea5631ccb8e;p=sfa.git parse a string or a file. --- diff --git a/util/rspec.py b/util/rspec.py index 5445aa42..23e20f9f 100644 --- a/util/rspec.py +++ b/util/rspec.py @@ -7,11 +7,15 @@ from types import StringTypes class Rspec(): def __init__(self, xml = None, xsd = None): - self.xsd = xsd - self.rootNode = None - if xml: - self.parseString(xml) - + self.xsd = xsd # schema + self.rootNode = None # root of the dom + self.dict = {} # dict of the rspec. + if xml: + if type(xml) == file: + self.parseFile(xml) + if type(xml) == str: + self.parseString(xml) + self.dict = self.toDict() def _getText(self, nodelist): rc = ""