Skip to content

Commit

Permalink
Updated ATF
Browse files Browse the repository at this point in the history
  • Loading branch information
abeckus committed Apr 14, 2016
1 parent 46331a1 commit 2ef097e
Show file tree
Hide file tree
Showing 13 changed files with 2,040 additions and 555 deletions.
54 changes: 23 additions & 31 deletions ATF/Framework/Atf.Core/Dom/XmlSchemaTypeLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,32 +751,32 @@ private void WalkParticle(XmlSchemaParticle particle, DomNodeType nodeType)
}

if (childNodeType != null)
{
int minOccurs;
int maxOccurs;
{
int minOccurs = (int)Math.Min(element.MinOccurs, Int32.MaxValue);
int maxOccurs = (int)Math.Min(element.MaxOccurs, Int32.MaxValue);

// If <xs:choice> is within a <xs:sequence>, choose the most relaxed constraints.
if (particle.Parent is XmlSchemaChoice)
{
var parent = (XmlSchemaChoice)particle.Parent;
minOccurs = (int)Math.Min(Math.Min(element.MinOccurs, parent.MinOccurs), Int32.MaxValue);
maxOccurs = (int)Math.Min(Math.Max(element.MaxOccurs, parent.MaxOccurs), Int32.MaxValue);
if (parent.MinOccurs != 1)
minOccurs = (int)Math.Min(Math.Max(element.MinOccurs, parent.MinOccurs), Int32.MaxValue);
if (parent.MaxOccurs != 1)
maxOccurs = (int)Math.Min(Math.Max(element.MaxOccurs, parent.MaxOccurs), Int32.MaxValue);
}
else if (particle.Parent is XmlSchemaSequence)
{
var parent = (XmlSchemaSequence)particle.Parent;
minOccurs = (int)Math.Min(Math.Min(element.MinOccurs, parent.MinOccurs), Int32.MaxValue);
maxOccurs = (int)Math.Min(Math.Max(element.MaxOccurs, parent.MaxOccurs), Int32.MaxValue);
}
else
{
minOccurs = (int)Math.Min(element.MinOccurs, Int32.MaxValue);
maxOccurs = (int)Math.Min(element.MaxOccurs, Int32.MaxValue);
{
var parent = (XmlSchemaSequence)particle.Parent;
if (parent.MinOccurs != 1)
minOccurs = (int)Math.Min(Math.Max(element.MinOccurs, parent.MinOccurs), Int32.MaxValue);
if (parent.MaxOccurs != 1)
maxOccurs = (int)Math.Min(Math.Max(element.MaxOccurs, parent.MaxOccurs), Int32.MaxValue);

}

ChildInfo childInfo = new ChildInfo(GetFieldName(element.QualifiedName), childNodeType, maxOccurs > 1);

if (minOccurs > 0 || maxOccurs < Int32.MaxValue)
if ( (minOccurs > 0 || maxOccurs < Int32.MaxValue)
&& minOccurs <= maxOccurs)
{
childInfo.AddRule(new ChildCountRule(minOccurs, maxOccurs));
}
Expand All @@ -794,23 +794,15 @@ private void WalkParticle(XmlSchemaParticle particle, DomNodeType nodeType)
}
else
{
// if sequence, continue collecting elements
XmlSchemaSequence sequence = particle as XmlSchemaSequence;
if (sequence != null)
XmlSchemaGroupBase grp = particle as XmlSchemaSequence;
if(grp == null) grp = particle as XmlSchemaChoice;
if (grp == null) grp = particle as XmlSchemaAll;

if (grp != null)
{
foreach (XmlSchemaParticle subParticle in sequence.Items)
foreach (XmlSchemaParticle subParticle in grp.Items)
WalkParticle(subParticle, nodeType);
}
else
{
XmlSchemaChoice choice = particle as XmlSchemaChoice;
if (choice != null)
{
// for now, treat choice as if it were a sequence
foreach (XmlSchemaParticle subParticle in choice.Items)
WalkParticle(subParticle, nodeType);
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ private void ActiveDockContentStateChanged(object sender, EventArgs e)

private DockPaneStripBase GetDockPaneStripBase(DockContent dockContent)
{
DockPane dockPane = dockContent.Pane;
DockPane dockPane = dockContent != null ? dockContent.Pane : null;
if (dockPane != null)
{
foreach (Control c in dockPane.Controls)
Expand Down
Loading

0 comments on commit 2ef097e

Please sign in to comment.