From eca77e124608c792e1e3b07a3da7aec1c8382cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20Sch=C3=B6lzel?= Date: Fri, 10 Jun 2022 15:20:22 +0200 Subject: [PATCH] Choices with nested compositors (sequences or choices) are now recognized as choices --- Units/XMLDataBindingGenerator.pas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Units/XMLDataBindingGenerator.pas b/Units/XMLDataBindingGenerator.pas index 048fec7..5b62f40 100644 --- a/Units/XMLDataBindingGenerator.pas +++ b/Units/XMLDataBindingGenerator.pas @@ -790,13 +790,23 @@ end; function TXMLDataBindingGenerator.IsChoice(AElement: IXMLElementDef): Boolean; var compositor: IXMLElementCompositor; - + parent: IXMLNode; begin Result := False; - if Supports(AElement.ParentNode, IXMLElementCompositor, compositor) then - Result := (compositor.CompositorType = ctChoice) and - (compositor.ElementDefs.Count > 1); + parent := AElement.ParentNode; + while Supports(parent, IXMLElementCompositor, compositor) do + begin + if compositor.CompositorType = ctSequence then + begin + parent := compositor.ParentNode; + end else + begin + Result := (compositor.CompositorType = ctChoice) and + (compositor.ElementDefs.Count + compositor.Compositors.Count > 1); + Exit; + end; + end; end;