2
using MonoDevelop.Ide.CodeCompletion;
3
using MonoDevelop.XmlEditor;
7
using System.Xml.Schema;
9
namespace MonoDevelop.XmlEditor.Tests.Schema
12
/// Element that has a single attribute.
15
public class FindAttributeFromComplexTypeFixture : SchemaTestFixtureBase
17
XmlSchemaAttribute attribute;
18
XmlSchemaAttribute missingAttribute;
20
public override void FixtureInit()
22
XmlElementPath path = new XmlElementPath();
23
path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
25
XmlSchemaElement element = SchemaCompletionData.FindElement(path);
26
attribute = SchemaCompletionData.FindAttribute(element, "name");
27
missingAttribute = SchemaCompletionData.FindAttribute(element, "missing");
31
public void AttributeFound()
33
Assert.IsNotNull(attribute);
37
public void CannotFindUnknownAttribute()
39
Assert.IsNull(missingAttribute);
42
protected override string GetSchema()
44
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" +
45
" <xs:element name=\"note\">\r\n" +
46
" <xs:complexType>\r\n" +
47
" <xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
48
" </xs:complexType>\r\n" +
49
" </xs:element>\r\n" +