parse a string or a file.
authorFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Mon, 26 Jan 2009 19:53:13 +0000 (19:53 +0000)
committerFaiyaz Ahmed <faiyaza@cs.princeton.edu>
Mon, 26 Jan 2009 19:53:13 +0000 (19:53 +0000)
util/rspec.py

index 5445aa4..23e20f9 100644 (file)
@@ -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 = ""