X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfatables%2Fxmlextension.py;h=813cd6d3bb8cf88609a89e8b025b6f9ceab59a79;hp=84e336fa1813f47816c0bb4299c0522ec5804336;hb=e57b7150dee76d42fc15f9477a3045e5171c8878;hpb=b46f8ee1c69124fb2f99384ebb59c1f09fc459db diff --git a/sfatables/xmlextension.py b/sfatables/xmlextension.py index 84e336fa..813cd6d3 100644 --- a/sfatables/xmlextension.py +++ b/sfatables/xmlextension.py @@ -8,14 +8,14 @@ import libxml2 from sfatables.globals import * class Xmlextension: - context = "" - processor = "" - operand = "VALUE" - arguments = [] + def __init__(self, file_path): + self.context = "" + self.processor = "" + self.operand = "VALUE" + self.arguments = [] + self.terminal = 0 - def __init__(self, component_name): - filename = match_dir+"/"+component_name+".xml" - self.xmldoc = libxml2.parseFile(filename) + self.xmldoc = libxml2.parseFile(file_path) # TODO: Check xmldoc against a schema p = self.xmldoc.xpathNewContext() @@ -34,6 +34,9 @@ class Xmlextension: help = p.xpathEval('//rule/argument/help') target = p.xpathEval('//rule/argument/operand') + context = p.xpathEval('//attributes/attribute[@terminal="yes"]') + self.terminal = (context != []) + self.arguments = map(lambda (name,help,target):{'name':name.content,'help':help.content,'target':target.content}, zip(name,help,target)) p.xpathFreeContext()