diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs index 74eb613b6f..c5825a3d43 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathNodeTextMarker.cs @@ -45,7 +45,7 @@ namespace ICSharpCode.XmlEditor public static void AddMarker(IDocument document, XPathNodeMatch node) { if (node.HasLineInfo() && node.Value.Length > 0) { - markers.Add(new XPathNodeTextMarker(document, document.PositionToOffset(node.LineNumber + 1, node.LinePosition), node)); + markers.Add(new XPathNodeTextMarker(document, document.PositionToOffset(node.LineNumber + 1, node.LinePosition + 1), node)); } } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs index 6a286e8947..93752f966e 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs @@ -79,9 +79,22 @@ namespace ICSharpCode.XmlEditor public static XmlCompletionDataProvider GetProvider(string extension) { - string defaultNamespacePrefix = XmlSchemaManager.GetNamespacePrefix(extension); - XmlSchemaCompletionData defaultSchemaCompletionData = XmlSchemaManager.GetSchemaCompletionData(extension); - return new XmlCompletionDataProvider(XmlSchemaManager.SchemaCompletionDataItems, + string defaultNamespacePrefix; + XmlSchemaCompletionData defaultSchemaCompletionData; + XmlSchemaCompletionDataCollection schemas; + + if (PropertyService.Initialized) { + schemas = XmlSchemaManager.SchemaCompletionDataItems; + defaultNamespacePrefix = XmlSchemaManager.GetNamespacePrefix(extension); + defaultSchemaCompletionData = XmlSchemaManager.GetSchemaCompletionData(extension); + } else { + // for NUnit tests + defaultNamespacePrefix = string.Empty; + schemas = new XmlSchemaCompletionDataCollection(); + defaultSchemaCompletionData = null; + } + + return new XmlCompletionDataProvider(schemas, defaultSchemaCompletionData, defaultNamespacePrefix); } diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs index 97adde8bab..fe3e4d855c 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewClipboardHandlerTestFixture.cs @@ -5,6 +5,7 @@ // $Revision: 4018 $ // +using ICSharpCode.Core; using System; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Gui; diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs index 52198e0849..f93dd96b1b 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlViewContent.cs @@ -23,6 +23,7 @@ namespace XmlEditor.Tests.Utils public MockXmlViewContent(OpenedFile file) { this.file = file; + this.Files.Add(file); this.document = new AvalonEditDocumentAdapter(); }