diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
index 9ee86943b2..22123e124d 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
@@ -234,15 +234,12 @@ namespace ICSharpCode.XmlEditor
///
void ReadSchema(XmlReader reader)
{
- try
- {
+ try {
schema = XmlSchema.Read(reader, new ValidationEventHandler(SchemaValidation));
schema.Compile(new ValidationEventHandler(SchemaValidation));
namespaceUri = schema.TargetNamespace;
- }
- finally
- {
+ } finally {
reader.Close();
}
}
@@ -882,7 +879,7 @@ namespace ICSharpCode.XmlEditor
} else {
// Abstract element?
XmlSchemaElement abstractElement = FindElement(element.RefName);
- if (abstractElement.IsAbstract) {
+ if (abstractElement != null && abstractElement.IsAbstract) {
matchedElement = FindSubstitutionGroupElement(abstractElement.QualifiedName, name);
}
}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj
index 87795ac5e8..9cd81ef6f1 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj
@@ -14,23 +14,34 @@
8.0.50215
Program
..\..\..\..\..\bin\SharpDevelop.exe
+ False
+ Auto
+ 4194304
+ AnyCPU
+ 4096
+ 0618
- True
False
False
True
..\..\..\..\..\AddIns\AddIns\DisplayBindings\XmlEditor\
- False
+ false
- False
True
False
False
..\..\..\..\..\AddIns\AddIns\DisplayBindings\XmlEditor\
False
+
+ Full
+ true
+
+
+ False
+
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/MissingSchemaElementTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/MissingSchemaElementTestFixture.cs
new file mode 100644
index 0000000000..0d1bd9938b
--- /dev/null
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/MissingSchemaElementTestFixture.cs
@@ -0,0 +1,56 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using ICSharpCode.TextEditor.Gui.CompletionWindow;
+using ICSharpCode.XmlEditor;
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace XmlEditor.Tests.Schema
+{
+ [TestFixture]
+ public class MissingSchemaElementTestFixture : SchemaTestFixtureBase
+ {
+ ICompletionData[] barElementAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("root", "http://foo"));
+ path.Elements.Add(new QualifiedName("bar", "http://foo"));
+ barElementAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void BarHasOneAttribute()
+ {
+ Assert.AreEqual(1, barElementAttributes.Length, "Should have 1 attribute.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "\r\n" +
+ "\t\r\n" +
+ "\t\t\r\n" +
+ "\t\t\t\r\n" +
+ "\t\t\t\r\n" +
+ "\t\t\r\n" +
+ "\t\t\r\n" +
+ "\t\r\n" +
+ "\t\r\n" +
+ "\t\r\n" +
+ "\t\t\r\n" +
+ "\t\r\n" +
+ "\t\r\n" +
+ "";
+ }
+ }
+}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
index c3f2be1138..20c7df8aea 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
@@ -89,6 +89,7 @@
+