diff --git a/src/Model/Checker.cs b/src/Model/Checker.cs
index 18d719e9..d3d845d3 100644
--- a/src/Model/Checker.cs
+++ b/src/Model/Checker.cs
@@ -179,6 +179,7 @@ bool LoadSchemas(XmlDocument doc, XmlSchemaSet set, SchemaResolver resolver)
{
result |= LoadSchemasForNamespace(set, resolver, sc, nsuri, root);
}
+ result |= LoadSchemasForNamespace(set, resolver, sc, doc.DocumentElement.NamespaceURI, root);
}
// Make sure all the required includes or imports are there.
// This is making up for a possible bug in XmlSchemaSet where it
diff --git a/src/Model/XmlHelpers.cs b/src/Model/XmlHelpers.cs
index 773466e4..faa9c9b6 100644
--- a/src/Model/XmlHelpers.cs
+++ b/src/Model/XmlHelpers.cs
@@ -219,7 +219,7 @@ public static bool IsXsiAttribute(XmlNode node)
{
if (node == null) return false;
return node.NodeType == XmlNodeType.Attribute &&
- (node.LocalName == "type" && node.NamespaceURI == "http://www.w3.org/2001/XMLSchema-instance");
+ node.NamespaceURI == "http://www.w3.org/2001/XMLSchema-instance";
}
}
diff --git a/src/UnitTests/UnitTest1.cs b/src/UnitTests/UnitTest1.cs
index 253130cd..c558bbee 100644
--- a/src/UnitTests/UnitTest1.cs
+++ b/src/UnitTests/UnitTest1.cs
@@ -123,6 +123,15 @@ Window LaunchNotepad(string filename, bool testSettings = true, bool debugMouse
return window;
}
+ AutomationWrapper ErrorList
+ {
+ get
+ {
+ AutomationWrapper grid = this.window.FindDescendant("DataGridView");
+ return grid;
+ }
+ }
+
AutomationWrapper XmlTreeView
{
@@ -690,7 +699,7 @@ public void TestIntellisense()
private void NavigateErrorWithMouse()
{
- AutomationWrapper grid = this.window.FindDescendant("DataGridView");
+ AutomationWrapper grid = this.ErrorList;
AutomationWrapper row = grid.FirstChild;
row = row.NextSibling;
Point pt = row.Bounds.Center();
@@ -1337,6 +1346,42 @@ public void TestSchemaDialog()
}
+
+ [TestMethod]
+ [Timeout(TestMethodTimeout)]
+ public void TestXsiAttributes()
+ {
+ Trace.WriteLine("TestXsiAttributes==========================================================");
+ string testFile = _testDir + "UnitTests\\test13.xml";
+ var w = LaunchNotepad(testFile);
+
+ AutomationWrapper grid = this.ErrorList;
+ AutomationWrapper description = grid.FirstChild.NextSibling.FirstChild.NextSibling;
+ var text = description.SimpleValue;
+ if (!text.Contains("The 'last_changed' element is invalid"))
+ {
+ throw new Exception("Missing validation error");
+ }
+
+ // correct the value of the xsi:nil attribute
+ w.SendKeystrokes("{END}{RIGHT}{DOWN}{TAB}{ENTER}true{ENTER}");
+ Sleep(500);
+
+ try
+ {
+ description = grid.FirstChild.NextSibling.FirstChild.NextSibling;
+ text = description.SimpleValue;
+ throw new Exception($"Error list should now be empty, but found: {text}");
+ }
+ catch (Exception ex)
+ {
+ if (!ex.Message.Contains("There is no next sibling"))
+ {
+ throw new Exception($"Unexpected error: {ex.Message}");
+ }
+ }
+ }
+
[TestMethod]
[Timeout(TestMethodTimeout)]
public void TestSchemaGeneration()
diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj
index 27a3fa85..d6bb468c 100644
--- a/src/UnitTests/UnitTests.csproj
+++ b/src/UnitTests/UnitTests.csproj
@@ -79,6 +79,7 @@
+
@@ -126,6 +127,9 @@
Designer
+
+ Designer
+
Designer
diff --git a/src/UnitTests/test13.xml b/src/UnitTests/test13.xml
new file mode 100644
index 00000000..ef08422e
--- /dev/null
+++ b/src/UnitTests/test13.xml
@@ -0,0 +1,5 @@
+
+
+ Chris
+
+
\ No newline at end of file
diff --git a/src/UnitTests/test13.xsd b/src/UnitTests/test13.xsd
new file mode 100644
index 00000000..f09087aa
--- /dev/null
+++ b/src/UnitTests/test13.xsd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Updates/Updates.xml b/src/Updates/Updates.xml
index 0a53f477..eef0e37d 100644
--- a/src/Updates/Updates.xml
+++ b/src/Updates/Updates.xml
@@ -11,6 +11,7 @@
Fix issue #418: check setttings-file for "read-only".
+ Fix issue #398: XmlNotepad detects xml-errors at empty nillable xsd:date Elements, but xml is correct
Issue 409: Not able to validate XML against multiple not referenced Schemas