diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs index 125dc3b814..38e37bb182 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs @@ -794,8 +794,9 @@ namespace ICSharpCode.XmlEditor XmlSchemaSequence sequence = complexType.Particle as XmlSchemaSequence; XmlSchemaChoice choice = complexType.Particle as XmlSchemaChoice; XmlSchemaGroupRef groupRef = complexType.Particle as XmlSchemaGroupRef; + XmlSchemaAll all = complexType.Particle as XmlSchemaAll; XmlSchemaComplexContent complexContent = complexType.ContentModel as XmlSchemaComplexContent; - + if (sequence != null) { matchedElement = FindElement(sequence.Items, name); } else if (choice != null) { @@ -810,6 +811,8 @@ namespace ICSharpCode.XmlEditor } } else if (groupRef != null) { matchedElement = FindElement(groupRef, name); + } else if (all != null) { + matchedElement = FindElement(all.Items, name); } return matchedElement; diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs index 4daecf18ea..0fb2ec2593 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/AllElementTestFixture.cs @@ -21,13 +21,18 @@ namespace XmlEditor.Tests.Schema public class AllElementTestFixture : SchemaTestFixtureBase { ICompletionData[] personElementChildren; + ICompletionData[] firstNameAttributes; + ICompletionData[] firstNameElementChildren; public override void FixtureInit() { XmlElementPath path = new XmlElementPath(); path.Elements.Add(new QualifiedName("person", "http://foo")); - personElementChildren = SchemaCompletionData.GetChildElementCompletionData(path); + + path.Elements.Add(new QualifiedName("firstname", "http://foo")); + firstNameAttributes = SchemaCompletionData.GetAttributeCompletionData(path); + firstNameElementChildren = SchemaCompletionData.GetChildElementCompletionData(path); } [Test] @@ -37,13 +42,34 @@ namespace XmlEditor.Tests.Schema "Should be 2 child elements."); } + [Test] + public void FirstNameElementHasAttribute() + { + Assert.AreEqual(1, firstNameAttributes.Length, "Should have one attribute."); + } + + [Test] + public void FirstNameElementHasChildren() + { + Assert.AreEqual(2, firstNameElementChildren.Length, + "Should be 2 child elements."); + } + protected override string GetSchema() { return "\r\n" + " \r\n" + " \r\n" + " \r\n" + - " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + " \r\n" + " \r\n" + " \r\n" +