1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-08-17 06:20:23 +03:00

Fixed min/maxOccurs for group references.

minOccurs and maxOccurs were taken from
the group definition (where it is in fact illegal
to have these attributes). Now they are correctly
taken from the tag that is making the reference
to the definition.
This commit is contained in:
Cleric-K 2015-10-28 07:49:55 -07:00 committed by AKritski
parent 49548a9dbb
commit 63d774f4a6

View File

@ -327,6 +327,8 @@ namespace XSDDiagram.Rendering
{
DiagramItem childDiagramGroup = new DiagramItem();
childDiagramGroup.ItemType = DiagramItemType.group;
XMLSchema.group referenceGroup = null;
if (childGroup.@ref != null)
{
childDiagramGroup.IsReference = true;
@ -337,7 +339,10 @@ namespace XSDDiagram.Rendering
{
XMLSchema.group group = grpObject.Tag as XMLSchema.group;
if (group != null)
{
referenceGroup = childGroup;
childGroup = group;
}
}
}
else if (type == DiagramItemGroupType.Group)
@ -353,13 +358,13 @@ namespace XSDDiagram.Rendering
childDiagramGroup.Diagram = this;
childDiagramGroup.TabSchema = childGroup;
int occurrence;
if (int.TryParse(childGroup.minOccurs, out occurrence))
if (int.TryParse(referenceGroup != null ? referenceGroup.minOccurs : childGroup.minOccurs, out occurrence))
childDiagramGroup.MinOccurrence = occurrence;
else
childDiagramGroup.MinOccurrence = -1;
//try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
//catch { childDiagramGroup.MinOccurrence = -1; }
if (int.TryParse(childGroup.maxOccurs, out occurrence))
if (int.TryParse(referenceGroup != null ? referenceGroup.maxOccurs : childGroup.maxOccurs, out occurrence))
childDiagramGroup.MaxOccurrence = occurrence;
else
childDiagramGroup.MaxOccurrence = -1;