7 # Validate RSPEC hiearchy, values, types, and names using supplied xsd.
9 # Faiyaz Ahmed <faiyaza at cs dot princeton dot edu>
11 # Copyright 2009 Princeton University
12 # http://www.planet-lab.org
16 from xml.dom import minidom
19 def getText(nodelist):
22 if node.nodeType == node.TEXT_NODE:
26 # complexType: a supernode comprised of element nodes below it.
27 def traverseComplexType(cmpTypeNode):
29 if cmpTypeNode.hasChildNodes():
30 for n in cmpTypeNode.getElementsByTagName("xsd:attribute"):
31 _elements[n.getAttribute("name")] = {'type': n.getAttribute("type")}
33 def buildDict(document):
34 if document.hasChildNodes():
35 for i in document.childNodes: buildDict(i)
36 print document.localName
39 buildDict(minidom.parse(fname))
41 if __name__ == '__main__':
42 main(fname="planetlab.xsd")