Browse Source

Added Goto Definition support for an XML schema. XML editor now supports navigation points. Xml query history now set to 20 items.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1683 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 19 years ago
parent
commit
e63247c63f
  1. 30
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/GoToSchemaDefinitionCommand.cs
  2. 26
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/GoToSchemaDefinitionEditAction.cs
  3. 2
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathQueryControl.cs
  4. 84
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs
  5. 2
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs
  6. 291
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs
  7. 220
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
  8. 15
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
  9. 14
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaManager.cs
  10. 178
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs
  11. 4
      src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin
  12. 2
      src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj
  13. 64
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeGroupReferenceSelectedTestFixture.cs
  14. 79
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeReferenceSelectedTestFixture.cs
  15. 49
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeSelectedTestFixture.cs
  16. 77
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeTypeSelectedTestFixture.cs
  17. 87
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementReferenceSelectedTestFixture.cs
  18. 85
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementReferenceWithPrefixSelectedTestFixture.cs
  19. 58
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementSelectedTestFixture.cs
  20. 63
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementTypeSelectedTestFixture.cs
  21. 66
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementTypeWithPrefixSelectedTestFixture.cs
  22. 98
      src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/GroupReferenceSelectedTestFixture.cs
  23. 170
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/ActiveElementUnderCursorTests.cs
  24. 4
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameTestFixture.cs
  25. 80
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameUnderCursorTests.cs
  26. 73
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs
  27. 8
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/InsideAttributeValueTestFixture.cs
  28. 8
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/ParentElementPathTestFixture.cs
  29. 59
      src/AddIns/DisplayBindings/XmlEditor/Test/Schema/FindAttributeFromComplexTypeTestFixture.cs
  30. 62
      src/AddIns/DisplayBindings/XmlEditor/Test/Schema/GetSchemaFromFileNameTestFixture.cs
  31. 57
      src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs
  32. 38
      src/AddIns/DisplayBindings/XmlEditor/Test/Schema/XmlSchemaNamespaceTests.cs
  33. 17
      src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
  34. 8
      src/AddIns/DisplayBindings/XmlEditor/XmlEditor.sln

30
src/AddIns/DisplayBindings/XmlEditor/Project/Src/GoToSchemaDefinitionCommand.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.XmlEditor
{
/// <summary>
/// Finds the definition of the Xml element or attribute under the cursor,
/// finds the schema definition for it and then opens the schema and puts the cursor
/// on the definition.
/// </summary>
public class GoToSchemaDefinitionCommand : AbstractMenuCommand
{
public override void Run()
{
XmlView view = XmlView.ActiveXmlView;
if (view != null) {
view.GoToSchemaDefinition();
}
}
}
}

26
src/AddIns/DisplayBindings/XmlEditor/Project/Src/GoToSchemaDefinitionEditAction.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Actions;
using System;
namespace ICSharpCode.XmlEditor
{
/// <summary>
/// Finds the schema definition of the Xml element or attribute under the cursor
/// when the user presses Control+Enter
/// </summary>
public class GoToSchemaDefinitionEditAction : AbstractEditAction
{
public override void Execute(TextArea services)
{
GoToSchemaDefinitionCommand goToDefinitionCommand = new GoToSchemaDefinitionCommand();
goToDefinitionCommand.Run();
}
}
}

2
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XPathQueryControl.cs

@ -38,7 +38,7 @@ namespace ICSharpCode.XmlEditor @@ -38,7 +38,7 @@ namespace ICSharpCode.XmlEditor
/// <summary>
/// The total number of xpath queries to remember.
/// </summary>
const int xpathQueryHistoryLimit = 5;
const int xpathQueryHistoryLimit = 20;
bool ignoreXPathTextChanges;

84
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs

@ -33,8 +33,7 @@ namespace ICSharpCode.XmlEditor @@ -33,8 +33,7 @@ namespace ICSharpCode.XmlEditor
}
public override ImageList ImageList {
get
{
get {
return XmlCompletionDataImageList.GetImageList();
}
}
@ -53,7 +52,7 @@ namespace ICSharpCode.XmlEditor @@ -53,7 +52,7 @@ namespace ICSharpCode.XmlEditor
break;
case '<':
// Child element intellisense.
XmlElementPath parentPath = XmlParser.GetParentElementPath(text, text.Length);
XmlElementPath parentPath = XmlParser.GetParentElementPath(text);
if (parentPath.Elements.Count > 0) {
return GetChildElementCompletionData(parentPath);
} else if (defaultSchemaCompletionData != null) {
@ -90,6 +89,49 @@ namespace ICSharpCode.XmlEditor @@ -90,6 +89,49 @@ namespace ICSharpCode.XmlEditor
return null;
}
/// <summary>
/// Finds the schema given the xml element path.
/// </summary>
public XmlSchemaCompletionData FindSchema(XmlElementPath path)
{
if (path.Elements.Count > 0) {
string namespaceUri = path.Elements[0].Namespace;
if (namespaceUri.Length > 0) {
return schemaCompletionDataItems[namespaceUri];
} else if (defaultSchemaCompletionData != null) {
// Use the default schema namespace if none
// specified in a xml element path, otherwise
// we will not find any attribute or element matches
// later.
foreach (QualifiedName name in path.Elements) {
if (name.Namespace.Length == 0) {
name.Namespace = defaultSchemaCompletionData.NamespaceUri;
}
}
return defaultSchemaCompletionData;
}
}
return null;
}
/// <summary>
/// Finds the schema given a namespace URI.
/// </summary>
public XmlSchemaCompletionData FindSchema(string namespaceUri)
{
return schemaCompletionDataItems[namespaceUri];
}
/// <summary>
/// Gets the schema completion data that was created from the specified
/// schema filename.
/// </summary>
public XmlSchemaCompletionData FindSchemaFromFileName(string fileName)
{
return schemaCompletionDataItems.GetSchemaFromFileName(fileName);
}
ICompletionData[] GetChildElementCompletionData(XmlElementPath path)
{
ICompletionData[] completionData = null;
@ -125,41 +167,5 @@ namespace ICSharpCode.XmlEditor @@ -125,41 +167,5 @@ namespace ICSharpCode.XmlEditor
return completionData;
}
XmlSchemaCompletionData FindSchema(XmlElementPath path)
{
XmlSchemaCompletionData schemaData = null;
if (path.Elements.Count > 0) {
string namespaceUri = path.Elements[0].Namespace;
if (namespaceUri.Length > 0) {
schemaData = schemaCompletionDataItems[namespaceUri];
} else if (defaultSchemaCompletionData != null) {
// Use the default schema namespace if none
// specified in a xml element path, otherwise
// we will not find any attribute or element matches
// later.
foreach (QualifiedName name in path.Elements) {
if (name.Namespace.Length == 0) {
name.Namespace = defaultSchemaCompletionData.NamespaceUri;
}
}
schemaData = defaultSchemaCompletionData;
}
}
return schemaData;
}
// string GetTextFromStartToEndOfCurrentLine(TextArea textArea)
// {
// LineSegment line = textArea.Document.GetLineSegment(textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset));
// if (line != null) {
// return textArea.Document.GetText(0, line.Offset + line.Length);
// }
//
// return String.Empty;//textArea.Document.GetText(0, textArea.Caret.Offset);
// }
}
}

2
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.XmlEditor @@ -51,7 +51,7 @@ namespace ICSharpCode.XmlEditor
/// Gets the schemas that the xml editor will use.
/// </summary>
/// <remarks>
/// Probably should have NOT a 'set' property, but allowing one
/// Probably should NOT have a 'set' property, but allowing one
/// allows us to share the completion data amongst multiple
/// xml editor controls.
/// </remarks>

291
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.XmlEditor @@ -87,7 +87,7 @@ namespace ICSharpCode.XmlEditor
QualifiedName elementName = GetElementName(elementText);
NamespaceURI elementNamespace = GetElementNamespace(elementText);
path = GetParentElementPath(xml, index);
path = GetParentElementPath(xml.Substring(0, index));
if (elementNamespace.Namespace.Length == 0) {
if (path.Elements.Count > 0) {
QualifiedName parentName = path.Elements[path.Elements.Count - 1];
@ -96,24 +96,51 @@ namespace ICSharpCode.XmlEditor @@ -96,24 +96,51 @@ namespace ICSharpCode.XmlEditor
}
}
path.Elements.Add(new QualifiedName(elementName.Name, elementNamespace.Namespace, elementNamespace.Prefix));
path.Elements.Add(new QualifiedName(elementName.Name, elementNamespace.Namespace, elementNamespace.Prefix));
path.Compact();
}
path.Compact();
return path;
}
}
/// <summary>
/// Gets path of the xml element start tag that the specified
/// <paramref name="index"/> is currently located. This is different to the
/// GetActiveElementStartPath method since the index can be inside the element
/// name.
/// </summary>
/// <remarks>If the index outside the start tag then an empty path
/// is returned.</remarks>
public static XmlElementPath GetActiveElementStartPathAtIndex(string xml, int index)
{
// Find first non xml element name character to the right of the index.
index = GetCorrectedIndex(xml.Length, index);
int currentIndex = index;
for (; currentIndex < xml.Length; ++currentIndex) {
char ch = xml[currentIndex];
if (!IsXmlNameChar(ch)) {
break;
}
}
string elementText = GetElementNameAtIndex(xml, currentIndex);
if (elementText != null) {
return GetActiveElementStartPath(xml, currentIndex, elementText);
}
return new XmlElementPath();
}
/// <summary>
/// Gets the parent element path based on the index position.
/// </summary>
public static XmlElementPath GetParentElementPath(string xml, int index)
public static XmlElementPath GetParentElementPath(string xml)
{
XmlElementPath path = new XmlElementPath();
try {
StringReader reader = new StringReader(xml);
XmlTextReader xmlReader = new XmlTextReader(reader);
xmlReader.XmlResolver = null;
while (xmlReader.Read()) {
switch (xmlReader.NodeType) {
case XmlNodeType.Element:
@ -205,61 +232,53 @@ namespace ICSharpCode.XmlEditor @@ -205,61 +232,53 @@ namespace ICSharpCode.XmlEditor
index = GetCorrectedIndex(xml.Length, index);
string name = String.Empty;
// From the end of the string work backwards until we have
// picked out the attribute name.
StringBuilder reversedAttributeName = new StringBuilder();
return GetAttributeName(xml, index, true, true, true);
}
/// <summary>
/// Gets the name of the attribute at the specified index. The index
/// can be anywhere inside the attribute name or in the attribute value.
/// </summary>
public static string GetAttributeNameAtIndex(string xml, int index)
{
index = GetCorrectedIndex(xml.Length, index);
bool ignoreWhitespace = true;
bool ignoreQuote = true;
bool ignoreEqualsSign = true;
int currentIndex = index;
bool invalidString = true;
for (int i = 0; i <= index; ++i) {
char currentChar = xml[currentIndex];
bool ignoreEqualsSign = false;
bool ignoreQuote = false;
if (IsInsideAttributeValue(xml, index)) {
// Find attribute name start.
int elementStartIndex = GetActiveElementStartIndex(xml, index);
if (elementStartIndex == -1) {
return String.Empty;
}
if (Char.IsLetterOrDigit(currentChar)) {
if (!ignoreEqualsSign) {
ignoreWhitespace = false;
reversedAttributeName.Append(currentChar);
}
} else if (Char.IsWhiteSpace(currentChar)) {
if (ignoreWhitespace == false) {
// Reached the start of the attribute name.
invalidString = false;
// Find equals sign.
for (int i = index; i > elementStartIndex; --i) {
char ch = xml[i];
if (ch == '=') {
index = i;
ignoreEqualsSign = true;
break;
}
} else if ((currentChar == '\'') || (currentChar == '\"')) {
if (ignoreQuote) {
ignoreQuote = false;
} else {
break;
}
} else if (currentChar == '='){
if (ignoreEqualsSign) {
ignoreEqualsSign = false;
} else {
break;
}
} else if (IsAttributeValueChar(currentChar)) {
if (!ignoreQuote) {
}
} else {
// Find end of attribute name.
for (; index < xml.Length; ++index) {
char ch = xml[index];
if (!Char.IsLetterOrDigit(ch)) {
if (ch == '\'' || ch == '\"') {
ignoreQuote = true;
ignoreEqualsSign = true;
}
break;
}
} else {
break;
}
--currentIndex;
}
if (!invalidString) {
name = ReverseString(reversedAttributeName.ToString());
--index;
}
return name;
return GetAttributeName(xml, index, ignoreWhitespace, ignoreQuote, ignoreEqualsSign);
}
/// <summary>
@ -308,10 +327,12 @@ namespace ICSharpCode.XmlEditor @@ -308,10 +327,12 @@ namespace ICSharpCode.XmlEditor
return false;
}
index = GetCorrectedIndex(xml.Length, index);
if (index > xml.Length) {
index = xml.Length;
}
int elementStartIndex = GetActiveElementStartIndex(xml, index);
if (elementStartIndex == - 1) {
if (elementStartIndex == -1) {
return false;
}
@ -322,7 +343,7 @@ namespace ICSharpCode.XmlEditor @@ -322,7 +343,7 @@ namespace ICSharpCode.XmlEditor
int doubleQuotesCount = 0;
int singleQuotesCount = 0;
char lastQuoteChar = ' ';
for (int i = index; i > elementStartIndex; --i) {
for (int i = index - 1; i > elementStartIndex; --i) {
char ch = xml[i];
if (ch == '=') {
foundEqualsSign = true;
@ -350,6 +371,64 @@ namespace ICSharpCode.XmlEditor @@ -350,6 +371,64 @@ namespace ICSharpCode.XmlEditor
return isInside;
}
/// <summary>
/// Gets the attribute value at the specified index.
/// </summary>
/// <returns>An empty string if no attribute value can be found.</returns>
public static string GetAttributeValueAtIndex(string xml, int index)
{
if (!IsInsideAttributeValue(xml, index)) {
return String.Empty;
}
index = GetCorrectedIndex(xml.Length, index);
int elementStartIndex = GetActiveElementStartIndex(xml, index);
if (elementStartIndex == -1) {
return String.Empty;
}
// Find equals sign.
int equalsSignIndex = -1;
for (int i = index; i > elementStartIndex; --i) {
char ch = xml[i];
if (ch == '=') {
equalsSignIndex = i;
break;
}
}
if (equalsSignIndex == -1) {
return String.Empty;
}
// Find attribute value.
char quoteChar = ' ';
bool foundQuoteChar = false;
StringBuilder attributeValue = new StringBuilder();
for (int i = equalsSignIndex; i < xml.Length; ++i) {
char ch = xml[i];
if (!foundQuoteChar) {
if (ch == '\"' || ch == '\'') {
quoteChar = ch;
foundQuoteChar = true;
}
} else {
if (ch == quoteChar) {
// End of attribute value.
return attributeValue.ToString();
} else if (IsAttributeValueChar(ch) || (ch == '\"' || ch == '\'')) {
attributeValue.Append(ch);
} else {
// Invalid character found.
return String.Empty;
}
}
}
return String.Empty;
}
/// <summary>
/// Gets the text of the xml element start tag that the index is
/// currently inside.
@ -360,17 +439,14 @@ namespace ICSharpCode.XmlEditor @@ -360,17 +439,14 @@ namespace ICSharpCode.XmlEditor
static string GetActiveElementStartText(string xml, int index)
{
int elementStartIndex = GetActiveElementStartIndex(xml, index);
if (elementStartIndex >= 0) {
if (elementStartIndex < index) {
int elementEndIndex = GetActiveElementEndIndex(xml, index);
int elementEndIndex = GetActiveElementEndIndex(xml, index);
if (elementEndIndex >= index) {
return xml.Substring(elementStartIndex, elementEndIndex - elementStartIndex);
}
}
}
return null;
}
@ -444,6 +520,8 @@ namespace ICSharpCode.XmlEditor @@ -444,6 +520,8 @@ namespace ICSharpCode.XmlEditor
int index = xml.IndexOf(' ');
if (index > 0) {
name = xml.Substring(1, index - 1);
} else {
name = xml.Substring(1);
}
QualifiedName qualifiedName = new QualifiedName();
@ -511,5 +589,100 @@ namespace ICSharpCode.XmlEditor @@ -511,5 +589,100 @@ namespace ICSharpCode.XmlEditor
}
return index;
}
/// <summary>
/// Gets the active element path given the element text.
/// </summary>
static XmlElementPath GetActiveElementStartPath(string xml, int index, string elementText)
{
QualifiedName elementName = GetElementName(elementText);
NamespaceURI elementNamespace = GetElementNamespace(elementText);
XmlElementPath path = GetParentElementPath(xml.Substring(0, index));
if (elementNamespace.Namespace.Length == 0) {
if (path.Elements.Count > 0) {
QualifiedName parentName = path.Elements[path.Elements.Count - 1];
elementNamespace.Namespace = parentName.Namespace;
elementNamespace.Prefix = parentName.Prefix;
}
}
path.Elements.Add(new QualifiedName(elementName.Name, elementNamespace.Namespace, elementNamespace.Prefix));
path.Compact();
return path;
}
static string GetAttributeName(string xml, int index, bool ignoreWhitespace, bool ignoreQuote, bool ignoreEqualsSign)
{
string name = String.Empty;
// From the end of the string work backwards until we have
// picked out the attribute name.
StringBuilder reversedAttributeName = new StringBuilder();
int currentIndex = index;
bool invalidString = true;
for (int i = 0; i <= index; ++i) {
char currentChar = xml[currentIndex];
if (Char.IsLetterOrDigit(currentChar)) {
if (!ignoreEqualsSign) {
ignoreWhitespace = false;
reversedAttributeName.Append(currentChar);
}
} else if (Char.IsWhiteSpace(currentChar)) {
if (ignoreWhitespace == false) {
// Reached the start of the attribute name.
invalidString = false;
break;
}
} else if ((currentChar == '\'') || (currentChar == '\"')) {
if (ignoreQuote) {
ignoreQuote = false;
} else {
break;
}
} else if (currentChar == '='){
if (ignoreEqualsSign) {
ignoreEqualsSign = false;
} else {
break;
}
} else if (IsAttributeValueChar(currentChar)) {
if (!ignoreQuote) {
break;
}
} else {
break;
}
--currentIndex;
}
if (!invalidString) {
name = ReverseString(reversedAttributeName.ToString());
}
return name;
}
/// <summary>
/// Gets the element name at the specified index.
/// </summary>
static string GetElementNameAtIndex(string xml, int index)
{
int elementStartIndex = GetActiveElementStartIndex(xml, index);
if (elementStartIndex >= 0 && elementStartIndex < index) {
int elementEndIndex = GetActiveElementEndIndex(xml, index);
if (elementEndIndex == -1) {
elementEndIndex = xml.IndexOf(' ', elementStartIndex);
}
if (elementEndIndex >= elementStartIndex) {
return xml.Substring(elementStartIndex, elementEndIndex - elementStartIndex);
}
}
return null;
}
}
}

220
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs

@ -221,6 +221,151 @@ namespace ICSharpCode.XmlEditor @@ -221,6 +221,151 @@ namespace ICSharpCode.XmlEditor
return data.ToArray();
}
/// <summary>
/// Finds the element that exists at the specified path.
/// </summary>
/// <remarks>This method is not used when generating completion data,
/// but is a useful method when locating an element so we can jump
/// to its schema definition.</remarks>
/// <returns><see langword="null"/> if no element can be found.</returns>
public XmlSchemaElement FindElement(XmlElementPath path)
{
XmlSchemaElement element = null;
for (int i = 0; i < path.Elements.Count; ++i) {
QualifiedName name = path.Elements[i];
if (i == 0) {
// Look for root element.
element = FindElement(name);
if (element == null) {
break;
}
} else {
element = FindChildElement(element, name);
if (element == null) {
break;
}
}
}
return element;
}
/// <summary>
/// Finds an element in the schema.
/// </summary>
/// <remarks>
/// Only looks at the elements that are defined in the
/// root of the schema so it will not find any elements
/// that are defined inside any complex types.
/// </remarks>
public XmlSchemaElement FindElement(QualifiedName name)
{
foreach (XmlSchemaElement element in schema.Elements.Values) {
if (name.Equals(element.QualifiedName)) {
return element;
}
}
return null;
}
/// <summary>
/// Finds the complex type with the specified name.
/// </summary>
public XmlSchemaComplexType FindComplexType(QualifiedName name)
{
XmlQualifiedName qualifiedName = new XmlQualifiedName(name.Name, name.Namespace);
return FindNamedType(schema, qualifiedName);
}
/// <summary>
/// Finds the specified attribute name given the element.
/// </summary>
/// <remarks>This method is not used when generating completion data,
/// but is a useful method when locating an attribute so we can jump
/// to its schema definition.</remarks>
/// <returns><see langword="null"/> if no attribute can be found.</returns>
public XmlSchemaAttribute FindAttribute(XmlSchemaElement element, string name)
{
XmlSchemaAttribute attribute = null;
XmlSchemaComplexType complexType = GetElementAsComplexType(element);
if (complexType != null) {
attribute = FindAttribute(complexType, name);
}
return attribute;
}
/// <summary>
/// Finds the attribute group with the specified name.
/// </summary>
public XmlSchemaAttributeGroup FindAttributeGroup(string name)
{
return FindAttributeGroup(schema, name);
}
/// <summary>
/// Finds the simple type with the specified name.
/// </summary>
public XmlSchemaSimpleType FindSimpleType(string name)
{
XmlQualifiedName qualifiedName = new XmlQualifiedName(name, namespaceUri);
return FindSimpleType(qualifiedName);
}
/// <summary>
/// Finds the specified attribute in the schema. This method only checks
/// the attributes defined in the root of the schema.
/// </summary>
public XmlSchemaAttribute FindAttribute(string name)
{
foreach (XmlSchemaAttribute attribute in schema.Attributes.Values) {
if (attribute.Name == name) {
return attribute;
}
}
return null;
}
/// <summary>
/// Finds the schema group with the specified name.
/// </summary>
public XmlSchemaGroup FindGroup(string name)
{
if (name != null) {
foreach (XmlSchemaObject schemaObject in schema.Groups.Values) {
XmlSchemaGroup group = schemaObject as XmlSchemaGroup;
if (group != null) {
if (group.Name == name) {
return group;
}
}
}
}
return null;
}
/// <summary>
/// Takes the name and creates a qualified name using the namespace of this
/// schema.
/// </summary>
/// <remarks>If the name is of the form myprefix:mytype then the correct
/// namespace is determined from the prefix. If the name is not of this
/// form then no prefix is added.</remarks>
public QualifiedName CreateQualifiedName(string name)
{
int index = name.IndexOf(":");
if (index >= 0) {
string prefix = name.Substring(0, index);
name = name.Substring(index + 1);
foreach (XmlQualifiedName xmlQualifiedName in schema.Namespaces.ToArray()) {
if (xmlQualifiedName.Name == prefix) {
return new QualifiedName(name, xmlQualifiedName.Namespace, prefix);
}
}
}
// Default behaviour just return the name with the namespace uri.
return new QualifiedName(name, namespaceUri);
}
/// <summary>
/// Handler for schema validation errors.
/// </summary>
@ -256,27 +401,6 @@ namespace ICSharpCode.XmlEditor @@ -256,27 +401,6 @@ namespace ICSharpCode.XmlEditor
xmlReader.XmlResolver = null;
ReadSchema(xmlReader);
}
/// <summary>
/// Finds an element in the schema.
/// </summary>
/// <remarks>
/// Only looks at the elements that are defined in the
/// root of the schema so it will not find any elements
/// that are defined inside any complex types.
/// </remarks>
XmlSchemaElement FindElement(QualifiedName name)
{
XmlSchemaElement matchedElement = null;
foreach (XmlSchemaElement element in schema.Elements.Values) {
if (name.Equals(element.QualifiedName)) {
matchedElement = element;
break;
}
}
return matchedElement;
}
/// <summary>
/// Finds an element in the schema.
@ -425,7 +549,7 @@ namespace ICSharpCode.XmlEditor @@ -425,7 +549,7 @@ namespace ICSharpCode.XmlEditor
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
XmlSchemaGroup group = FindNamedGroup(groupRef.RefName.Name);
XmlSchemaGroup group = FindGroup(groupRef.RefName.Name);
if (group != null) {
XmlSchemaSequence sequence = group.Particle as XmlSchemaSequence;
XmlSchemaChoice choice = group.Particle as XmlSchemaChoice;
@ -536,33 +660,6 @@ namespace ICSharpCode.XmlEditor @@ -536,33 +660,6 @@ namespace ICSharpCode.XmlEditor
return documentation;
}
/// <summary>
/// Finds the element that exists at the specified path.
/// </summary>
XmlSchemaElement FindElement(XmlElementPath path)
{
XmlSchemaElement element = null;
for (int i = 0; i < path.Elements.Count; ++i) {
QualifiedName name = path.Elements[i];
if (i == 0) {
// Look for root element.
element = FindElement(name);
if (element == null) {
break;
}
} else {
element = FindChildElement(element, name);
if (element == null) {
break;
}
}
}
return element;
}
XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaElement element)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@ -916,7 +1013,7 @@ namespace ICSharpCode.XmlEditor @@ -916,7 +1013,7 @@ namespace ICSharpCode.XmlEditor
{
XmlSchemaElement matchedElement = null;
XmlSchemaGroup group = FindNamedGroup(groupRef.RefName.Name);
XmlSchemaGroup group = FindGroup(groupRef.RefName.Name);
if (group != null) {
XmlSchemaSequence sequence = group.Particle as XmlSchemaSequence;
XmlSchemaChoice choice = group.Particle as XmlSchemaChoice;
@ -963,25 +1060,6 @@ namespace ICSharpCode.XmlEditor @@ -963,25 +1060,6 @@ namespace ICSharpCode.XmlEditor
return matchedGroup;
}
XmlSchemaGroup FindNamedGroup(string name)
{
XmlSchemaGroup matchedGroup = null;
if (name != null) {
foreach (XmlSchemaObject schemaObject in schema.Groups.Values) {
XmlSchemaGroup group = schemaObject as XmlSchemaGroup;
if (group != null) {
if (group.Name == name) {
matchedGroup = group;
break;
}
}
}
}
return matchedGroup;
}
XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaElement element, string name)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
@ -1171,9 +1249,7 @@ namespace ICSharpCode.XmlEditor @@ -1171,9 +1249,7 @@ namespace ICSharpCode.XmlEditor
XmlSchemaAttribute FindAttribute(XmlSchemaComplexContentExtension extension, string name)
{
XmlSchemaAttribute matchedAttribute = FindAttribute(extension.Attributes, name);
return matchedAttribute;
return FindAttribute(extension.Attributes, name);
}
XmlSchemaAttribute FindAttribute(XmlSchemaComplexContentRestriction restriction, string name)

15
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using System;
using System.Collections;
@ -206,6 +207,20 @@ namespace ICSharpCode.XmlEditor @@ -206,6 +207,20 @@ namespace ICSharpCode.XmlEditor
List.Remove(val);
}
/// <summary>
/// Gets the schema completion data with the same filename.
/// </summary>
/// <returns><see langword="null"/> if no matching schema found.</returns>
public XmlSchemaCompletionData GetSchemaFromFileName(string fileName)
{
foreach (XmlSchemaCompletionData schema in this) {
if (FileUtility.IsEqualFileName(schema.FileName, fileName)) {
return schema;
}
}
return null;
}
/// <summary>
/// Enumerator that can iterate through a XmlSchemaCompletionDataCollection.
/// </summary>

14
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaManager.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using ICSharpCode.Core;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml;
namespace ICSharpCode.XmlEditor
@ -18,6 +19,8 @@ namespace ICSharpCode.XmlEditor @@ -18,6 +19,8 @@ namespace ICSharpCode.XmlEditor
/// </summary>
public class XmlSchemaManager
{
public const string XmlSchemaNamespace = "http://www.w3.org/2001/XMLSchema";
static XmlSchemaCompletionDataCollection schemas = null;
static XmlSchemaManager manager = null;
@ -29,6 +32,15 @@ namespace ICSharpCode.XmlEditor @@ -29,6 +32,15 @@ namespace ICSharpCode.XmlEditor
{
}
/// <summary>
/// Determines whether the specified namespace is actually the W3C namespace for
/// XSD files.
/// </summary>
public static bool IsXmlSchemaNamespace(string schemaNamespace)
{
return schemaNamespace == XmlSchemaNamespace;
}
/// <summary>
/// Gets the schemas that SharpDevelop knows about.
/// </summary>
@ -122,7 +134,7 @@ namespace ICSharpCode.XmlEditor @@ -122,7 +134,7 @@ namespace ICSharpCode.XmlEditor
void ReadSchemas()
{
// MSBuild schemas are in framework directory:
ReadSchemas(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), true);
ReadSchemas(RuntimeEnvironment.GetRuntimeDirectory(), true);
ReadSchemas(SchemaFolder, true);
ReadSchemas(UserSchemaFolder, false);
}

178
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs

@ -190,6 +190,57 @@ namespace ICSharpCode.XmlEditor @@ -190,6 +190,57 @@ namespace ICSharpCode.XmlEditor
return SelectNodes(Text, xpath, namespaces);
}
/// <summary>
/// Gets the XmlSchemaObject that defines the currently selected xml element or
/// attribute.
/// </summary>
/// <param name="text">The complete xml text.</param>
/// <param name="index">The current cursor index.</param>
/// <param name="provider">The completion data provider</param>
public static XmlSchemaObject GetSchemaObjectSelected(string xml, int index, XmlCompletionDataProvider provider)
{
return GetSchemaObjectSelected(xml, index, provider, null);
}
/// <summary>
/// Gets the XmlSchemaObject that defines the currently selected xml element or
/// attribute.
/// </summary>
/// <param name="text">The complete xml text.</param>
/// <param name="index">The current cursor index.</param>
/// <param name="provider">The completion data provider</param>
/// <param name="currentSchemaCompletionData">This is the schema completion data for the
/// schema currently being displayed. This can be null if the document is
/// not a schema.</param>
public static XmlSchemaObject GetSchemaObjectSelected(string xml, int index, XmlCompletionDataProvider provider, XmlSchemaCompletionData currentSchemaCompletionData)
{
// Find element under cursor.
XmlElementPath path = XmlParser.GetActiveElementStartPathAtIndex(xml, index);
string attributeName = XmlParser.GetAttributeNameAtIndex(xml, index);
// Find schema definition object.
XmlSchemaCompletionData schemaCompletionData = provider.FindSchema(path);
XmlSchemaObject schemaObject = null;
if (schemaCompletionData != null) {
XmlSchemaElement element = schemaCompletionData.FindElement(path);
schemaObject = element;
if (element != null) {
if (attributeName.Length > 0) {
XmlSchemaAttribute attribute = schemaCompletionData.FindAttribute(element, attributeName);
if (attribute != null) {
if (currentSchemaCompletionData != null) {
schemaObject = GetSchemaObjectReferenced(xml, index, provider, currentSchemaCompletionData, element, attribute);
} else {
schemaObject = attribute;
}
}
}
return schemaObject;
}
}
return null;
}
/// <summary>
/// Validates the xml against known schemas.
/// </summary>
@ -316,6 +367,25 @@ namespace ICSharpCode.XmlEditor @@ -316,6 +367,25 @@ namespace ICSharpCode.XmlEditor
}
}
/// <summary>
/// Finds the definition of the xml element or attribute under the cursor
/// in the corresponding schema and then displays that schema and the definition
/// found.
/// </summary>
public void GoToSchemaDefinition()
{
// Find schema object for selected xml element or attribute.
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(xmlEditor.SchemaCompletionDataItems, xmlEditor.DefaultSchemaCompletionData, xmlEditor.DefaultNamespacePrefix);
XmlSchemaCompletionData currentSchemaCompletionData = provider.FindSchemaFromFileName(FileName);
XmlSchemaObject schemaObject = GetSchemaObjectSelected(Text, xmlEditor.ActiveTextAreaControl.Caret.Offset, provider, currentSchemaCompletionData);
// Open schema.
if (schemaObject != null && schemaObject.SourceUri != null && schemaObject.SourceUri.Length > 0) {
string fileName = schemaObject.SourceUri.Replace("file:///", String.Empty);
FileService.JumpToFilePosition(fileName, schemaObject.LineNumber - 1, schemaObject.LinePosition - 1);
}
}
#region IEditable interface
public IClipboardHandler ClipboardHandler {
@ -413,6 +483,13 @@ namespace ICSharpCode.XmlEditor @@ -413,6 +483,13 @@ namespace ICSharpCode.XmlEditor
OnSaved(new SaveEventArgs(true));
}
public override INavigationPoint BuildNavPoint()
{
int line = Line;
LineSegment lineSegment = xmlEditor.Document.GetLineSegment(line);
string text = xmlEditor.Document.GetText(lineSegment);
return new TextNavigationPoint(FileName, line, Column, text);
}
#endregion
@ -1041,5 +1118,106 @@ namespace ICSharpCode.XmlEditor @@ -1041,5 +1118,106 @@ namespace ICSharpCode.XmlEditor
return false;
}
}
/// <summary>
/// Checks whether the element belongs to the XSD namespace.
/// </summary>
static bool IsXmlSchemaNamespace(XmlSchemaElement element)
{
XmlQualifiedName qualifiedName = element.QualifiedName;
if (qualifiedName != null) {
return XmlSchemaManager.IsXmlSchemaNamespace(qualifiedName.Namespace);
}
return false;
}
/// <summary>
/// If the attribute value found references another item in the schema
/// return this instead of the attribute schema object. For example, if the
/// user can select the attribute value and the code will work out the schema object pointed to by the ref
/// or type attribute:
///
/// xs:element ref="ref-name"
/// xs:attribute type="type-name"
/// </summary>
/// <returns>
/// The <paramref name="attribute"/> if no schema object was referenced.
/// </returns>
static XmlSchemaObject GetSchemaObjectReferenced(string xml, int index, XmlCompletionDataProvider provider, XmlSchemaCompletionData currentSchemaCompletionData, XmlSchemaElement element, XmlSchemaAttribute attribute)
{
XmlSchemaObject schemaObject = null;
if (IsXmlSchemaNamespace(element)) {
// Find attribute value.
string attributeValue = XmlParser.GetAttributeValueAtIndex(xml, index);
if (attributeValue.Length == 0) {
return attribute;
}
if (attribute.Name == "ref") {
schemaObject = FindSchemaObjectReference(attributeValue, provider, currentSchemaCompletionData, element.Name);
} else if (attribute.Name == "type") {
schemaObject = FindSchemaObjectType(attributeValue, provider, currentSchemaCompletionData, element.Name);
}
}
if (schemaObject != null) {
return schemaObject;
}
return attribute;
}
/// <summary>
/// Attempts to locate the reference name in the specified schema.
/// </summary>
/// <param name="name">The reference to look up.</param>
/// <param name="schemaCompletionData">The schema completion data to use to
/// find the reference.</param>
/// <param name="elementName">The element to determine what sort of reference it is
/// (e.g. group, attribute, element).</param>
/// <returns><see langword="null"/> if no match can be found.</returns>
static XmlSchemaObject FindSchemaObjectReference(string name, XmlCompletionDataProvider provider, XmlSchemaCompletionData schemaCompletionData, string elementName)
{
QualifiedName qualifiedName = schemaCompletionData.CreateQualifiedName(name);
XmlSchemaCompletionData qualifiedNameSchema = provider.FindSchema(qualifiedName.Namespace);
if (qualifiedNameSchema != null) {
schemaCompletionData = qualifiedNameSchema;
}
switch (elementName) {
case "element":
return schemaCompletionData.FindElement(qualifiedName);
case "attribute":
return schemaCompletionData.FindAttribute(qualifiedName.Name);
case "group":
return schemaCompletionData.FindGroup(qualifiedName.Name);
case "attributeGroup":
return schemaCompletionData.FindAttributeGroup(qualifiedName.Name);
}
return null;
}
/// <summary>
/// Attempts to locate the type name in the specified schema.
/// </summary>
/// <param name="name">The type to look up.</param>
/// <param name="schemaCompletionData">The schema completion data to use to
/// find the type.</param>
/// <param name="elementName">The element to determine what sort of type it is
/// (e.g. group, attribute, element).</param>
/// <returns><see langword="null"/> if no match can be found.</returns>
static XmlSchemaObject FindSchemaObjectType(string name, XmlCompletionDataProvider provider, XmlSchemaCompletionData schemaCompletionData, string elementName)
{
QualifiedName qualifiedName = schemaCompletionData.CreateQualifiedName(name);
XmlSchemaCompletionData qualifiedNameSchema = provider.FindSchema(qualifiedName.Namespace);
if (qualifiedNameSchema != null) {
schemaCompletionData = qualifiedNameSchema;
}
switch (elementName) {
case "element":
return schemaCompletionData.FindComplexType(qualifiedName);
case "attribute":
return schemaCompletionData.FindSimpleType(qualifiedName.Name);
}
return null;
}
}
}

4
src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.addin

@ -131,6 +131,9 @@ @@ -131,6 +131,9 @@
<MenuItem id = "HideXPathResults"
label = "Hide &amp;XPath Results"
class = "ICSharpCode.XmlEditor.RemoveXPathHighlightingCommand"/>
<MenuItem id = "GoToDefinition"
label = "${res:ICSharpCode.NAntAddIn.GotoDefinitionMenuLabel}"
class = "ICSharpCode.XmlEditor.GoToSchemaDefinitionCommand"/>
<MenuItem id = "FileMode" label = "${res:XML.TextAreaContextMenu.FileMode}" type="Menu">
<MenuItem id = "HighlightBuilder" type="Builder" class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.HighlightingTypeBuilder" />
</MenuItem>
@ -156,6 +159,7 @@ @@ -156,6 +159,7 @@
<Path path = "/AddIns/XmlEditor/EditActions">
<EditAction id = "XmlCompletionPopup" class = "ICSharpCode.XmlEditor.CodeCompletionPopupCommand" keys = "Control|Space"/>
<EditAction id = "GoToDefinition" class = "ICSharpCode.XmlEditor.GoToSchemaDefinitionEditAction" keys = "Control|Enter"/>
</Path>
<!-- XPath Query pad -->

2
src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj

@ -113,6 +113,8 @@ @@ -113,6 +113,8 @@
<Compile Include="Src\XPathNodeMatch.cs" />
<Compile Include="Src\XPathNodeTextMarker.cs" />
<Compile Include="Src\RemoveXPathHighlightingCommand.cs" />
<Compile Include="Src\GoToSchemaDefinitionCommand.cs" />
<Compile Include="Src\GoToSchemaDefinitionEditAction.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">

64
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeGroupReferenceSelectedTestFixture.cs

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:attributeGroup/@ref is located in the schema.
/// </summary>
[TestFixture]
public class AttributeGroupReferenceSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaAttributeGroup schemaAttributeGroup;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("ref=\"coreattrs\"");
index = xml.IndexOf("coreattrs", index);
schemaAttributeGroup = (XmlSchemaAttributeGroup)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void AttributeGroupName()
{
Assert.AreEqual("coreattrs", schemaAttributeGroup.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
"<xs:attributeGroup name=\"coreattrs\">" +
"\t<xs:attribute name=\"id\" type=\"xs:string\"/>" +
"\t<xs:attribute name=\"style\" type=\"xs:string\"/>" +
"\t<xs:attribute name=\"title\" type=\"xs:string\"/>" +
"</xs:attributeGroup>" +
"\t<xs:element name=\"note\">\r\n" +
"\t\t<xs:complexType>\r\n" +
"\t\t\t<xs:attributeGroup ref=\"coreattrs\"/>" +
"\t\t\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
"\t\t</xs:complexType>\r\n" +
"\t</xs:element>\r\n" +
"</xs:schema>";
}
}
}

79
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeReferenceSelectedTestFixture.cs

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:attribute/@ref is located in the schema.
/// </summary>
[TestFixture]
public class AttributeReferenceSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaAttribute schemaAttribute;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("ref=\"dir\"");
index = xml.IndexOf("dir", index);
schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void AttributeName()
{
Assert.AreEqual("dir", schemaAttribute.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
" targetNamespace=\"http://foo/xhtml\"\r\n" +
" xmlns=\"http://foo/xhtml\"\r\n" +
" elementFormDefault=\"qualified\">\r\n" +
" <xs:element name=\"html\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"head\"/>\r\n" +
" <xs:element ref=\"body\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attributeGroup ref=\"i18n\"/>\r\n" +
" <xs:attribute name=\"id\" ref=\"dir\"/>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"\r\n" +
" <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
" <xs:element name=\"body\" type=\"xs:string\"/>\r\n" +
"\r\n" +
" <xs:attribute name=\"dir\">\r\n" +
" <xs:simpleType>\r\n" +
" <xs:restriction base=\"xs:token\">\r\n" +
" <xs:enumeration value=\"ltr\"/>\r\n" +
" <xs:enumeration value=\"rtl\"/>\r\n" +
" </xs:restriction>\r\n" +
" </xs:simpleType>\r\n" +
" </xs:attribute>\r\n" +
"</xs:schema>";
}
}
}

49
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeSelectedTestFixture.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
namespace XmlEditor.Tests.FindSchemaObject
{
[TestFixture]
public class AttributeSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaAttribute schemaAttribute;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, SchemaCompletionData, String.Empty);
string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, xml.IndexOf("name"), provider);
}
[Test]
public void AttributeName()
{
Assert.AreEqual("name", schemaAttribute.QualifiedName.Name, "Attribute name is incorrect.");
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
" <xs:element name=\"note\">\r\n" +
" <xs:complexType>\r\n" +
"\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"</xs:schema>";
}
}
}

77
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/AttributeTypeSelectedTestFixture.cs

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that a xs:attribute/@type can be located in the schema.
/// </summary>
[TestFixture]
public class AttributeTypeSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaSimpleType schemaSimpleType;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("type=\"dir\"/>");
index = xml.IndexOf("dir", index);
schemaSimpleType = (XmlSchemaSimpleType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void SimpleTypeName()
{
Assert.AreEqual("dir", schemaSimpleType.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
" targetNamespace=\"http://foo/xhtml\"\r\n" +
" xmlns=\"http://foo/xhtml\"\r\n" +
" elementFormDefault=\"qualified\">\r\n" +
" <xs:element name=\"html\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"head\"/>\r\n" +
" <xs:element ref=\"body\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attributeGroup ref=\"i18n\"/>\r\n" +
" <xs:attribute name=\"id\" type=\"dir\"/>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"\r\n" +
" <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
" <xs:element name=\"body\" type=\"xs:string\"/>\r\n" +
"\r\n" +
" <xs:simpleType name=\"dir\">\r\n" +
" <xs:restriction base=\"xs:token\">\r\n" +
" <xs:enumeration value=\"ltr\"/>\r\n" +
" <xs:enumeration value=\"rtl\"/>\r\n" +
" </xs:restriction>\r\n" +
" </xs:simpleType>\r\n" +
"</xs:schema>";
}
}
}

87
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementReferenceSelectedTestFixture.cs

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:element/@ref is located in the schema.
/// </summary>
[TestFixture]
public class ElementReferenceSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaAttribute schemaAttribute;
XmlSchemaElement referencedSchemaElement;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
schemaAttribute = (XmlSchemaAttribute)XmlView.GetSchemaObjectSelected(xml, xml.IndexOf("ref=\"name"), provider, SchemaCompletionData);
int index = xml.IndexOf("ref=\"name");
index = xml.IndexOf('n', index);
referencedSchemaElement = (XmlSchemaElement)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void AttributeName()
{
Assert.AreEqual("ref", schemaAttribute.QualifiedName.Name);
}
[Test]
public void ReferencedElementName()
{
Assert.AreEqual("name", referencedSchemaElement.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\">\r\n" +
"\r\n" +
"<!-- definition of simple elements -->\r\n" +
"<xs:element name=\"name\" type=\"xs:string\"/>\r\n" +
"<xs:element name=\"address\" type=\"xs:string\"/>\r\n" +
"\r\n" +
"<!-- definition of complex elements -->\r\n" +
"<xs:element name=\"shipto\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"name\"/>\r\n" +
" <xs:element ref=\"address\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attribute name=\"address\"/>\r\n" +
" </xs:complexType>\r\n" +
"</xs:element>\r\n" +
"\r\n" +
"<xs:element name=\"shiporder\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"shipto\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attribute name=\"id\"/>\r\n" +
" </xs:complexType>\r\n" +
"</xs:element>\r\n" +
"\r\n" +
"</xs:schema>";
}
}
}

85
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementReferenceWithPrefixSelectedTestFixture.cs

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:element/@ref='prefix:name' is located in the schema.
/// </summary>
[TestFixture]
public class ElementReferenceWithPrefixSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaElement referencedSchemaElement;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("ref=\"xs:list");
index = xml.IndexOf("xs", index);
referencedSchemaElement = (XmlSchemaElement)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void ReferencedElementName()
{
Assert.AreEqual("list", referencedSchemaElement.QualifiedName.Name);
}
[Test]
public void ReferencedElementNamespace()
{
Assert.AreEqual("http://www.w3.org/2001/XMLSchema", referencedSchemaElement.QualifiedName.Namespace);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\">\r\n" +
"\r\n" +
"<!-- definition of simple elements -->\r\n" +
"<xs:element name=\"name\" type=\"xs:string\"/>\r\n" +
"<xs:element name=\"address\" type=\"xs:string\"/>\r\n" +
"\r\n" +
"<!-- definition of complex elements -->\r\n" +
"<xs:element name=\"shipto\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"name\"/>\r\n" +
" <xs:element ref=\"xs:list\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attribute name=\"address\"/>\r\n" +
" </xs:complexType>\r\n" +
"</xs:element>\r\n" +
"\r\n" +
"<xs:element name=\"shiporder\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"shipto\"/>\r\n" +
" </xs:sequence>\r\n" +
" <xs:attribute name=\"id\"/>\r\n" +
" </xs:complexType>\r\n" +
"</xs:element>\r\n" +
"\r\n" +
"</xs:schema>";
}
}
}

58
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementSelectedTestFixture.cs

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
namespace XmlEditor.Tests.FindSchemaObject
{
[TestFixture]
public class ElementSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaElement schemaElement;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, SchemaCompletionData, String.Empty);
string xml = "<note xmlns='http://www.w3schools.com'></note>";
schemaElement = (XmlSchemaElement)XmlView.GetSchemaObjectSelected(xml, xml.IndexOf("note xmlns"), provider);
}
[Test]
public void SchemaElementNamespace()
{
Assert.AreEqual("http://www.w3schools.com",
schemaElement.QualifiedName.Namespace,
"Unexpected namespace.");
}
[Test]
public void SchemaElementName()
{
Assert.AreEqual("note", schemaElement.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<?xml version=\"1.0\"?>\r\n" +
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
"targetNamespace=\"http://www.w3schools.com\"\r\n" +
"xmlns=\"http://www.w3schools.com\"\r\n" +
"elementFormDefault=\"qualified\">\r\n" +
"<xs:element name=\"note\">\r\n" +
"</xs:element>\r\n" +
"</xs:schema>";
}
}
}

63
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementTypeSelectedTestFixture.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:element/@type is located in the schema.
/// </summary>
[TestFixture]
public class ElementTypeSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaComplexType schemaComplexType;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("type=\"text-type\"");
index = xml.IndexOf("text-type", index);
schemaComplexType = (XmlSchemaComplexType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void ComplexTypeName()
{
Assert.AreEqual("text-type", schemaComplexType.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
"\t<xs:element name=\"note\">\r\n" +
"\t\t<xs:complexType> \r\n" +
"\t\t\t<xs:sequence>\r\n" +
"\t\t\t\t<xs:element name=\"text\" type=\"text-type\"/>\r\n" +
"\t\t\t</xs:sequence>\r\n" +
"\t\t</xs:complexType>\r\n" +
"\t</xs:element>\r\n" +
"\t<xs:complexType name=\"text-type\">\r\n" +
"\t\t<xs:attribute name=\"foo\"/>\r\n" +
"\t</xs:complexType>\r\n" +
"</xs:schema>";
}
}
}

66
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/ElementTypeWithPrefixSelectedTestFixture.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:element/@type="prefix:name" is located in the schema.
/// </summary>
[TestFixture]
public class ElementTypeWithPrefixSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaComplexType schemaComplexType;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("type=\"xs:complexType\"");
index = xml.IndexOf("xs:complexType", index);
schemaComplexType = (XmlSchemaComplexType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void ComplexTypeName()
{
Assert.AreEqual("complexType", schemaComplexType.QualifiedName.Name);
}
[Test]
public void ComplexTypeNamespace()
{
Assert.AreEqual("http://www.w3.org/2001/XMLSchema", schemaComplexType.QualifiedName.Namespace);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
"\t<xs:element name=\"note\">\r\n" +
"\t\t<xs:complexType> \r\n" +
"\t\t\t<xs:sequence>\r\n" +
"\t\t\t\t<xs:element name=\"text\" type=\"xs:complexType\"/>\r\n" +
"\t\t\t</xs:sequence>\r\n" +
"\t\t</xs:complexType>\r\n" +
"\t</xs:element>\r\n" +
"</xs:schema>";
}
}
}

98
src/AddIns/DisplayBindings/XmlEditor/Test/FindSchemaObject/GroupReferenceSelectedTestFixture.cs

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
using XmlEditor.Tests.Schema;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.FindSchemaObject
{
/// <summary>
/// Tests that an xs:group/@ref is located in the schema.
/// </summary>
[TestFixture]
public class GroupReferenceSelectedTestFixture : SchemaTestFixtureBase
{
XmlSchemaGroup schemaGroup;
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("ref=\"block\"");
index = xml.IndexOf("block", index);
schemaGroup = (XmlSchemaGroup)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
[Test]
public void GroupName()
{
Assert.AreEqual("block", schemaGroup.QualifiedName.Name);
}
protected override string GetSchema()
{
return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
" targetNamespace=\"http://foo/xhtml\"\r\n" +
" xmlns=\"http://foo/xhtml\"\r\n" +
" elementFormDefault=\"qualified\">\r\n" +
"\r\n" +
" <xs:element name=\"html\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:element ref=\"head\"/>\r\n" +
" <xs:element ref=\"body\"/>\r\n" +
" </xs:sequence>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"\r\n" +
" <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
" <xs:element name=\"body\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:sequence>\r\n" +
" <xs:group ref=\"block\"/>\r\n" +
" <xs:element name=\"form\"/>\r\n" +
" </xs:sequence>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"\r\n" +
"\r\n" +
" <xs:group name=\"block\">\r\n" +
" <xs:choice>\r\n" +
" <xs:element ref=\"p\"/>\r\n" +
" <xs:group ref=\"heading\"/>\r\n" +
" </xs:choice>\r\n" +
" </xs:group>\r\n" +
"\r\n" +
" <xs:element name=\"p\">\r\n" +
" <xs:complexType>\r\n" +
" <xs:attribute name=\"id\"/>" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"\r\n" +
" <xs:group name=\"heading\">\r\n" +
" <xs:choice>\r\n" +
" <xs:element name=\"test\"/>\r\n" +
" <xs:element name=\"id\"/>\r\n" +
" </xs:choice>\r\n" +
" </xs:group>\r\n" +
"\r\n" +
"</xs:schema>";
}
}
}

170
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/ActiveElementUnderCursorTests.cs

@ -0,0 +1,170 @@ @@ -0,0 +1,170 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.Xml;
namespace XmlEditor.Tests.Parser
{
/// <summary>
/// Tests the XmlParser.GetActiveElementStartPathAtIndex which finds the element
/// path where the index is at. The index may be in the middle or start of the element
/// tag.
/// </summary>
[TestFixture]
public class ActiveElementUnderCursorTests
{
XmlElementPath elementPath;
XmlElementPath expectedElementPath;
string namespaceURI = "http://foo.com/foo.xsd";
[Test]
public void PathTest1()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar ";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("bar "));
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest2()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("bar>"));
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest3()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("ar>"));
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest4()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.Length - 1);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest5()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar a='a'>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("='a'"));
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest6()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar a='a'";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.Length - 1);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest7()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar a='a'";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.Length);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest8()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.Length);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest9()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar ";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.Length);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest10()
{
string text = "<foo xmlns='" + namespaceURI + "'><bar Id=\r\n</foo>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("Id="));
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
[Test]
public void PathTest11()
{
string text = "<foo xmlns='" + namespaceURI + "'>";
elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, 2);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
Assert.IsTrue(elementPath.Equals(expectedElementPath),
"Incorrect active element path.");
}
}
}

4
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameTestFixture.cs

@ -78,14 +78,14 @@ namespace XmlEditor.Tests.Parser @@ -78,14 +78,14 @@ namespace XmlEditor.Tests.Parser
public void FailureTest3()
{
string text = "a";
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length));
}
[Test]
public void FailureTest4()
{
string text = " a";
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length), "Should have retrieved the attribute name 'foo'");
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(text, text.Length));
}
[Test]

80
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameUnderCursorTests.cs

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
namespace XmlEditor.Tests.Parser
{
[TestFixture]
public class AttributeNameUnderCursorTests
{
[Test]
public void SuccessTest1()
{
string text = "<a foo";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
}
[Test]
public void SuccessTest2()
{
string text = "<a foo";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("foo")));
}
[Test]
public void SuccessTest3()
{
string text = "<a foo";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.IndexOf("oo")));
}
[Test]
public void SuccessTest4()
{
string text = "<a foo";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length - 2));
}
[Test]
public void SuccessTest5()
{
string text = "<a foo=";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, 3));
}
[Test]
public void SuccessTest6()
{
string text = "<a foo=";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
}
[Test]
public void SuccessTest7()
{
string text = "<a foo='";
Assert.AreEqual("foo", XmlParser.GetAttributeNameAtIndex(text, text.Length));
}
[Test]
public void SuccessTest8()
{
string text = "<a type='a";
Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length));
}
[Test]
public void SuccessTest9()
{
string text = "<a type='a'";
Assert.AreEqual("type", XmlParser.GetAttributeNameAtIndex(text, text.Length - 1));
}
}
}

73
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
namespace XmlEditor.Tests.Parser
{
[TestFixture]
public class AttributeValueUnderCursorTests
{
[Test]
public void SuccessTest1()
{
string text = "<a foo='abc'";
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
[Test]
public void SuccessTest2()
{
string text = "<a foo=\"abc\"";
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
[Test]
public void SuccessTest3()
{
string text = "<a foo='abc'";
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.Length - 2));
}
[Test]
public void SuccessTest4()
{
string text = "<a foo='abc'";
Assert.AreEqual("abc", XmlParser.GetAttributeValueAtIndex(text, text.IndexOf("abc")));
}
[Test]
public void SuccessTest5()
{
string text = "<a foo=''";
Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
[Test]
public void SuccessTest6()
{
string text = "<a foo='a'";
Assert.AreEqual("a", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
[Test]
public void SuccessTest7()
{
string text = "<a foo='a\"b\"c'";
Assert.AreEqual("a\"b\"c", XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
[Test]
public void FailureTest1()
{
string text = "<a foo='a";
Assert.AreEqual(String.Empty, XmlParser.GetAttributeValueAtIndex(text, text.Length - 1));
}
}
}

8
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/InsideAttributeValueTestFixture.cs

@ -48,6 +48,13 @@ namespace XmlEditor.Tests.Parser @@ -48,6 +48,13 @@ namespace XmlEditor.Tests.Parser
string xml = "<foo a=\" ";
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, xml.Length));
}
[Test]
public void DoubleQuotesTest5()
{
string xml = "<foo a=\"\"";
Assert.IsTrue(XmlParser.IsInsideAttributeValue(xml, 8));
}
[Test]
public void NoXmlElementStart()
@ -97,6 +104,5 @@ namespace XmlEditor.Tests.Parser @@ -97,6 +104,5 @@ namespace XmlEditor.Tests.Parser
string xml = "<foo a=\"''\"";
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length));
}
}
}

8
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/ParentElementPathTestFixture.cs

@ -23,7 +23,7 @@ namespace XmlEditor.Tests.Parser @@ -23,7 +23,7 @@ namespace XmlEditor.Tests.Parser
public void SuccessTest1()
{
string text = "<foo xmlns='" + namespaceURI + "' ><";
elementPath = XmlParser.GetParentElementPath(text, text.Length);
elementPath = XmlParser.GetParentElementPath(text);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
@ -35,7 +35,7 @@ namespace XmlEditor.Tests.Parser @@ -35,7 +35,7 @@ namespace XmlEditor.Tests.Parser
public void SuccessTest2()
{
string text = "<foo xmlns='" + namespaceURI + "' ><bar></bar><";
elementPath = XmlParser.GetParentElementPath(text, text.Length);
elementPath = XmlParser.GetParentElementPath(text);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
@ -47,7 +47,7 @@ namespace XmlEditor.Tests.Parser @@ -47,7 +47,7 @@ namespace XmlEditor.Tests.Parser
public void SuccessTest3()
{
string text = "<foo xmlns='" + namespaceURI + "' ><bar/><";
elementPath = XmlParser.GetParentElementPath(text, text.Length);
elementPath = XmlParser.GetParentElementPath(text);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));
@ -59,7 +59,7 @@ namespace XmlEditor.Tests.Parser @@ -59,7 +59,7 @@ namespace XmlEditor.Tests.Parser
public void SuccessTest4()
{
string text = "<bar xmlns='http://test.com'><foo xmlns='" + namespaceURI + "' ><";
elementPath = XmlParser.GetParentElementPath(text, text.Length);
elementPath = XmlParser.GetParentElementPath(text);
expectedElementPath = new XmlElementPath();
expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI));

59
src/AddIns/DisplayBindings/XmlEditor/Test/Schema/FindAttributeFromComplexTypeTestFixture.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using System.IO;
using System.Xml.Schema;
namespace XmlEditor.Tests.Schema
{
/// <summary>
/// Element that has a single attribute.
/// </summary>
[TestFixture]
public class FindAttributeFromComplexTypeFixture : SchemaTestFixtureBase
{
XmlSchemaAttribute attribute;
XmlSchemaAttribute missingAttribute;
public override void FixtureInit()
{
XmlElementPath path = new XmlElementPath();
path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
XmlSchemaElement element = SchemaCompletionData.FindElement(path);
attribute = SchemaCompletionData.FindAttribute(element, "name");
missingAttribute = SchemaCompletionData.FindAttribute(element, "missing");
}
[Test]
public void AttributeFound()
{
Assert.IsNotNull(attribute);
}
[Test]
public void CannotFindUnknownAttribute()
{
Assert.IsNull(missingAttribute);
}
protected override string GetSchema()
{
return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
" <xs:element name=\"note\">\r\n" +
" <xs:complexType>\r\n" +
"\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
" </xs:complexType>\r\n" +
" </xs:element>\r\n" +
"</xs:schema>";
}
}
}

62
src/AddIns/DisplayBindings/XmlEditor/Test/Schema/GetSchemaFromFileNameTestFixture.cs

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.Schema
{
[TestFixture]
public class GetSchemaFromFileNameTestFixture
{
XmlSchemaCompletionDataCollection schemas;
string expectedNamespace;
XmlCompletionDataProvider provider;
[TestFixtureSetUp]
public void SetUpFixture()
{
schemas = new XmlSchemaCompletionDataCollection();
XmlSchemaCompletionData completionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
expectedNamespace = completionData.NamespaceUri;
completionData.FileName = @"C:\Schemas\MySchema.xsd";
schemas.Add(completionData);
provider = new XmlCompletionDataProvider(schemas, completionData, String.Empty);
}
[Test]
public void RelativeFileName()
{
XmlSchemaCompletionData foundSchema = schemas.GetSchemaFromFileName(@"C:\Schemas\..\Schemas\MySchema.xsd");
Assert.AreEqual(expectedNamespace, foundSchema.NamespaceUri);
}
[Test]
public void RelativeFileNameFromProvider()
{
XmlSchemaCompletionData foundSchema = provider.FindSchemaFromFileName(@"C:\Schemas\..\Schemas\MySchema.xsd");
Assert.AreEqual(expectedNamespace, foundSchema.NamespaceUri);
}
[Test]
public void LowerCaseFileName()
{
XmlSchemaCompletionData foundSchema = schemas.GetSchemaFromFileName(@"C:\schemas\myschema.xsd");
Assert.AreEqual(expectedNamespace, foundSchema.NamespaceUri);
}
[Test]
public void MissingFileName()
{
Assert.IsNull(schemas.GetSchemaFromFileName(@"C:\Test\test.xsd"));
}
}
}

57
src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs

@ -13,63 +13,6 @@ using System.IO; @@ -13,63 +13,6 @@ using System.IO;
namespace XmlEditor.Tests.Schema
{
// public abstract class SchemaTestFixtureBase
// {
// /// <summary>
// /// Checks whether the specified name exists in the completion data.
// /// </summary>
// protected bool Contains(ICompletionData[] items, string name)
// {
// bool Contains = false;
//
// foreach (ICompletionData data in items) {
// if (data.Text[0] == name) {
// Contains = true;
// break;
// }
// }
//
// return Contains;
// }
//
// /// <summary>
// /// Checks whether the completion data specified by name has
// /// the correct description.
// /// </summary>
// protected bool ContainsDescription(ICompletionData[] items, string name, string description)
// {
// bool Contains = false;
//
// foreach (ICompletionData data in items) {
// if (data.Text[0] == name) {
// if (data.Description == description) {
// Contains = true;
// break;
// }
// }
// }
//
// return Contains;
// }
//
// /// <summary>
// /// Gets a count of the number of occurrences of a particular name
// /// in the completion data.
// /// </summary>
// protected int GetItemCount(ICompletionData[] items, string name)
// {
// int count = 0;
//
// foreach (ICompletionData data in items) {
// if (data.Text[0] == name) {
// ++count;
// }
// }
//
// return count;
// }
// }
public abstract class SchemaTestFixtureBase
{
XmlSchemaCompletionData schemaCompletionData;

38
src/AddIns/DisplayBindings/XmlEditor/Test/Schema/XmlSchemaNamespaceTests.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using System;
namespace XmlEditor.Tests.Schema
{
/// <summary>
/// Tests that the standard W3C namespace for XSD files is recognised.
/// </summary>
[TestFixture]
public class XmlSchemaNamespaceTests
{
[Test]
public void IsXmlSchemaNamespace()
{
Assert.IsTrue(XmlSchemaManager.IsXmlSchemaNamespace("http://www.w3.org/2001/XMLSchema"));
}
[Test]
public void IsNotXmlSchemaNamespace()
{
Assert.IsFalse(XmlSchemaManager.IsXmlSchemaNamespace("http://foo.com"));
}
[Test]
public void EmptyString()
{
Assert.IsFalse(XmlSchemaManager.IsXmlSchemaNamespace(String.Empty));
}
}
}

17
src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj

@ -103,6 +103,22 @@ @@ -103,6 +103,22 @@
<Compile Include="XPathQuery\XPathQueryHistoryTestFixture.cs" />
<Compile Include="XPathQuery\XPathNodeTextMarkerTests.cs" />
<Compile Include="Utils\MockDocument.cs" />
<Compile Include="Parser\ActiveElementUnderCursorTests.cs" />
<Compile Include="Parser\AttributeNameUnderCursorTests.cs" />
<Compile Include="Schema\FindAttributeFromComplexTypeTestFixture.cs" />
<Compile Include="Schema\XmlSchemaNamespaceTests.cs" />
<Compile Include="FindSchemaObject\ElementSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\AttributeSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\ElementReferenceSelectedTestFixture.cs" />
<Compile Include="Schema\GetSchemaFromFileNameTestFixture.cs" />
<Compile Include="Parser\AttributeValueUnderCursorTests.cs" />
<Compile Include="FindSchemaObject\ElementReferenceWithPrefixSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\AttributeReferenceSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\GroupReferenceSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\AttributeGroupReferenceSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\ElementTypeSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\ElementTypeWithPrefixSelectedTestFixture.cs" />
<Compile Include="FindSchemaObject\AttributeTypeSelectedTestFixture.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Schema\" />
@ -128,6 +144,7 @@ @@ -128,6 +144,7 @@
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
</ProjectReference>
<Folder Include="FindSchemaObject" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

8
src/AddIns/DisplayBindings/XmlEditor/XmlEditor.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.646
# SharpDevelop 2.0.0.1590
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor", "Project\XmlEditor.csproj", "{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor.Tests", "Test\XmlEditor.Tests.csproj", "{FC0FE702-A87D-4D70-A9B6-1ECCD611125F}"
@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libr @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -48,5 +50,9 @@ Global @@ -48,5 +50,9 @@ Global
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

Loading…
Cancel
Save