X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfatables%2Fxmlextension.py;h=5e298db9c358358419d0232be2aee3de7556323a;hp=412419b064e9e986e5fe6a1930a33ee32465902f;hb=f58fc949070f5f17d4dea42aa31b6d72ed6073ec;hpb=cf172a653c1d69c73fe5ff7cd93b4cee8187ab79 diff --git a/sfatables/xmlextension.py b/sfatables/xmlextension.py index 412419b0..5e298db9 100644 --- a/sfatables/xmlextension.py +++ b/sfatables/xmlextension.py @@ -8,16 +8,15 @@ 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 +35,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()