X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfatables%2Fxmlextension.py;h=809ea367abe144f747c82db697e21347ac84f289;hp=1e27e762cca306db19fb0e2987464f795a723df1;hb=38e28ae142af328b236b4200da6b07ffc3f44887;hpb=7a3131ef03d2a4b30cce63cb6f671a4e35da836d diff --git a/sfatables/xmlextension.py b/sfatables/xmlextension.py index 1e27e762..809ea367 100644 --- a/sfatables/xmlextension.py +++ b/sfatables/xmlextension.py @@ -8,14 +8,16 @@ 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" - self.xmldoc = libxml2.parseFile(filename) + print file_path + 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() @@ -34,6 +36,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()