(no commit message)
[sfa.git] / sfatables / xmlextension.py
1 import libxml2
2
3 class Xmlextension:
4     context = ""
5     processor = ""
6     operand = "VALUE"
7     arguments = []
8
9     def __init__(filename):
10         self.xmldoc = libxml2.parseFile(filename)
11         # TODO: Check xmldoc against a schema
12
13         p = self.xmldoc.XPathNewContext()
14
15         # <context select="..."/>
16         # <rule><argument param="..."/></rule>
17         # <processor name="..."/>
18
19         context = p.xpathEval('//context/@select')
20         self.context = context[0].value
21
22         processor = p.xpathEval('//processor@name')
23         self.context = processor[0].value
24
25         params = p.xpathEval('//rule/argument/@param')
26         self.arguments = [node.value for node in params]
27
28
29         return
30