Merge pull request #5 from selectline-software/NestedCompositorsAndRequiredElements
Elements in choices with nested compositors (sequences or choices) are now recognized as optional
This commit is contained in:
commit
1d5af8a7b4
@ -790,13 +790,23 @@ end;
|
|||||||
function TXMLDataBindingGenerator.IsChoice(AElement: IXMLElementDef): Boolean;
|
function TXMLDataBindingGenerator.IsChoice(AElement: IXMLElementDef): Boolean;
|
||||||
var
|
var
|
||||||
compositor: IXMLElementCompositor;
|
compositor: IXMLElementCompositor;
|
||||||
|
parent: IXMLNode;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
if Supports(AElement.ParentNode, IXMLElementCompositor, compositor) then
|
parent := AElement.ParentNode;
|
||||||
Result := (compositor.CompositorType = ctChoice) and
|
while Supports(parent, IXMLElementCompositor, compositor) do
|
||||||
(compositor.ElementDefs.Count > 1);
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user