5 def process_introspection_data(data
):
8 XMLREADER_START_ELEMENT_NODE_TYPE
= 1
9 XMLREADER_END_ELEMENT_NODE_TYPE
= 15
11 stream
= cStringIO
.StringIO(data
.encode('utf-8'))
12 input_source
= libxml2
.inputBuffer(stream
)
13 reader
= input_source
.newTextReader("urn:introspect")
21 name
= reader
.LocalName()
22 if reader
.NodeType() == XMLREADER_START_ELEMENT_NODE_TYPE
:
23 if (not current_iface
and not current_method
and name
== 'interface'):
24 current_iface
= reader
.GetAttribute('name')
25 elif (current_iface
and not current_method
and name
== 'method'):
26 current_method
= reader
.GetAttribute('name')
27 if reader
.IsEmptyElement():
28 method_map
[current_iface
+ '.' + current_method
] = ''
32 elif (current_iface
and current_method
and name
== 'arg'):
33 direction
= reader
.GetAttribute('direction')
35 if not direction
or direction
== 'in':
36 current_sigstr
= current_sigstr
+ reader
.GetAttribute('type')
38 elif reader
.NodeType() == XMLREADER_END_ELEMENT_NODE_TYPE
:
39 if (current_iface
and not current_method
and name
== 'interface'):
41 if (current_iface
and current_method
and name
== 'method'):
42 method_map
[current_iface
+ '.' + current_method
] = current_sigstr
49 raise exceptions
.IntrospectionParserException(data
)