X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfatables%2Fxmlextension.py;h=f90e0fb186b2f678191c2acd830c561168936398;hb=ecc85e0b923922cf7117d29b380f5284edb88f21;hp=412419b064e9e986e5fe6a1930a33ee32465902f;hpb=cf172a653c1d69c73fe5ff7cd93b4cee8187ab79;p=sfa.git diff --git a/sfatables/xmlextension.py b/sfatables/xmlextension.py index 412419b0..f90e0fb1 100644 --- a/sfatables/xmlextension.py +++ b/sfatables/xmlextension.py @@ -5,19 +5,17 @@ # - The parameters that the processor needs to evaluate the context import libxml2 -from sfatables.globals import * class Xmlextension: - context = "" - processor = "" - operand = "VALUE" - arguments = [] + def __init__(self, file_path): - def __init__(self, dir, component_name): - filename = dir+"/"+component_name+".xml" - import pdb - pdb.set_trace() - self.xmldoc = libxml2.parseFile(filename) + self.context = "" + self.processor = "" + self.operand = "VALUE" + self.arguments = [] + self.terminal = 0 + + self.xmldoc = libxml2.parseFile(file_path) # TODO: Check xmldoc against a schema p = self.xmldoc.xpathNewContext() @@ -36,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()