25
25
LOGGER = logging .getLogger ('matter-xml-parser' )
26
26
27
27
28
+ def _IsConformanceTagName (name : str ) -> bool :
29
+ return name in {'mandatoryConform' , 'optionalConform' , 'otherwiseConform' , 'provisionalConform' , 'deprecateConform' }
30
+
31
+
28
32
class ClusterNameHandler (BaseHandler ):
29
33
"""Handles /configurator/cluster/name elements."""
30
34
@@ -110,6 +114,9 @@ def GetNextProcessor(self, name: str, attrs):
110
114
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
111
115
elif name .lower () == 'description' :
112
116
return DescriptionHandler (self .context , self ._event )
117
+ elif _IsConformanceTagName (name ):
118
+ # we do not parse conformance at this point
119
+ return BaseHandler (self .context , handled = HandledDepth .ENTIRE_TREE )
113
120
else :
114
121
return BaseHandler (self .context )
115
122
@@ -145,6 +152,9 @@ def GetNextProcessor(self, name: str, attrs):
145
152
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
146
153
elif name .lower () == 'description' :
147
154
return AttributeDescriptionHandler (self .context , self ._attribute )
155
+ elif _IsConformanceTagName (name ):
156
+ # we do not parse conformance at this point
157
+ return BaseHandler (self .context , handled = HandledDepth .ENTIRE_TREE )
148
158
else :
149
159
return BaseHandler (self .context )
150
160
@@ -162,6 +172,18 @@ def EndProcessing(self):
162
172
self ._cluster .attributes .append (self ._attribute )
163
173
164
174
175
+ class SkipProvisioalHandler (BaseHandler ):
176
+ def __init__ (self , context : Context , attrs ):
177
+ super ().__init__ (context , handled = HandledDepth .SINGLE_TAG )
178
+
179
+ def GetNextProcessor (self , name : str , attrs ):
180
+ if _IsConformanceTagName (name ):
181
+ # we do not parse conformance at this point
182
+ return BaseHandler (self .context , handled = HandledDepth .ENTIRE_TREE )
183
+ else :
184
+ return BaseHandler (self .context )
185
+
186
+
165
187
class StructHandler (BaseHandler , IdlPostProcessor ):
166
188
""" Handling /configurator/struct elements."""
167
189
@@ -213,7 +235,7 @@ def GetNextProcessor(self, name: str, attrs):
213
235
field .qualities |= FieldQuality .FABRIC_SENSITIVE
214
236
215
237
self ._struct .fields .append (field )
216
- return BaseHandler (self .context , handled = HandledDepth . SINGLE_TAG )
238
+ return SkipProvisioalHandler (self .context , attrs )
217
239
elif name .lower () == 'cluster' :
218
240
self ._cluster_codes .add (ParseInt (attrs ['code' ]))
219
241
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
@@ -460,6 +482,9 @@ def GetNextProcessor(self, name: str, attrs):
460
482
if self ._command :
461
483
return DescriptionHandler (self .context , self ._command )
462
484
return BaseHandler (self .context , handled = HandledDepth .ENTIRE_TREE )
485
+ elif _IsConformanceTagName (name ):
486
+ # we do not parse conformance at this point
487
+ return BaseHandler (self .context , handled = HandledDepth .ENTIRE_TREE )
463
488
else :
464
489
return BaseHandler (self .context )
465
490
0 commit comments