public void Init()
		{
			LoadBarSchema();
			LoadFooSchema();
			fooSchemaData.IsReadOnly = true;
			LoadXmlSchema();
			
			schemas = new XmlSchemaCompletionCollection();
			schemas.Add(fooSchemaData);
			schemas.Add(barSchemaData);
			schemas.Add(xmlSchemaData);
			
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, new MockFileSystem(), factory);
			registeredXmlSchemas.Schemas.AddRange(schemas);

			string[] xmlFileExtensions = new string[] { ".foo", ".bar", ".xml" };
			
			DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations = new DefaultXmlSchemaFileAssociations();
			defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".foo", "http://foo"));
			defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".bar", "http://bar", "b"));
			
			properties = new Properties();
			associations = new XmlSchemaFileAssociations(properties, defaultSchemaFileAssociations, new XmlSchemaCompletionCollection());
			associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://xml"));
			
			panel = new MockXmlSchemasPanel();
			schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, xmlFileExtensions, associations, panel, factory);
			schemasEditor.LoadOptions();	
		}
		public void Init()
		{
			testSchemaXml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";
			XmlSchemaCompletion testSchema = new XmlSchemaCompletion(new StringReader(testSchemaXml));
			testSchema.IsReadOnly = false;

			string xml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://xml' />";
			XmlSchemaCompletion xmlSchema = new XmlSchemaCompletion(new StringReader(xml));
			xmlSchema.IsReadOnly = false;
			
			schemas = new XmlSchemaCompletionCollection();
			schemas.Add(testSchema);
			schemas.Add(xmlSchema);
			
			string userDirectory = @"c:\users\user\schemas";
			factory = new MockXmlSchemaCompletionDataFactory();
			MockFileSystem fileSystem = new MockFileSystem();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], userDirectory, fileSystem, factory);
			registeredXmlSchemas.Schemas.AddRange(schemas);
			
			properties = new Properties();
			associations = new XmlSchemaFileAssociations(properties, new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
			
			panel = new MockXmlSchemasPanel();
			schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
			schemasEditor.LoadOptions();
			
			panel.SelectedXmlSchemaListItemIndex = 0;
			schemasEditor.RemoveSelectedSchema();
		}
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();
            string xml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";

            schemas.Add(new XmlSchemaCompletion(new StringReader(xml)));
        }
        public void Init()
        {
            LoadBarSchema();
            LoadFooSchema();
            fooSchemaData.IsReadOnly = true;
            LoadXmlSchema();

            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(fooSchemaData);
            schemas.Add(barSchemaData);
            schemas.Add(xmlSchemaData);

            factory = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, new MockFileSystem(), factory);
            registeredXmlSchemas.Schemas.AddRange(schemas);

            string[] xmlFileExtensions = new string[] { ".foo", ".bar", ".xml" };

            DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations = new DefaultXmlSchemaFileAssociations();

            defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".foo", "http://foo"));
            defaultSchemaFileAssociations.Add(new XmlSchemaFileAssociation(".bar", "http://bar", "b"));

            properties   = new Properties();
            associations = new XmlSchemaFileAssociations(properties, defaultSchemaFileAssociations, new XmlSchemaCompletionCollection());
            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://xml"));

            panel         = new MockXmlSchemasPanel();
            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, xmlFileExtensions, associations, panel, factory);
            schemasEditor.LoadOptions();
        }
        public void Init()
        {
            testSchemaXml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";
            XmlSchemaCompletion testSchema = new XmlSchemaCompletion(new StringReader(testSchemaXml));

            testSchema.IsReadOnly = false;

            string xml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://xml' />";
            XmlSchemaCompletion xmlSchema = new XmlSchemaCompletion(new StringReader(xml));

            xmlSchema.IsReadOnly = false;

            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(testSchema);
            schemas.Add(xmlSchema);

            string userDirectory = @"c:\users\user\schemas";

            factory = new MockXmlSchemaCompletionDataFactory();
            MockFileSystem fileSystem = new MockFileSystem();

            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], userDirectory, fileSystem, factory);
            registeredXmlSchemas.Schemas.AddRange(schemas);

            properties   = new Properties();
            associations = new XmlSchemaFileAssociations(properties, new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            panel         = new MockXmlSchemasPanel();
            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
            schemasEditor.LoadOptions();

            panel.SelectedXmlSchemaListItemIndex = 0;
            schemasEditor.RemoveSelectedSchema();
        }
		public XmlSchemaFileAssociations(Properties properties, 
			DefaultXmlSchemaFileAssociations defaultSchemaFileAssociations,
			XmlSchemaCompletionCollection schemas)
		{
			this.properties = properties;
			this.defaultSchemaFileAssociations = defaultSchemaFileAssociations;
			this.schemas = schemas;
		}
		public void SetUpFixture()
		{
			schemas = new XmlSchemaCompletionCollection();
			XmlSchemaCompletion completionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
			expectedNamespace = completionData.NamespaceUri;
			completionData.FileName = FileName.Create(@"C:\Schemas\MySchema.xsd");
			schemas.Add(completionData);
		}
Ejemplo n.º 8
0
        public void GetSchemasForFooNamespaceReturnedSchemasContainDuplicateSchemas()
        {
            XmlSchemaCompletionCollection matchedSchemas = schemas.GetSchemas("foo");

            string[] expectedFileNames = new string[] { "foo.xsd", "duplicate-foo.xsd" };

            Assert.AreEqual(expectedFileNames, XmlSchemaCompletionCollectionFileNames.GetFileNames(matchedSchemas));
        }
		public void Init()
		{
			schemas = new XmlSchemaCompletionCollection();
			defaultXmlSchemaFileExtensions = CreateDefaultXmlSchemaFileExtensions();
			properties = new Properties();
			associations = new XmlSchemaFileAssociations(properties, defaultXmlSchemaFileExtensions, schemas);
			options = new XmlEditorOptions(properties);
		}
 public static string[] GetFileNames(XmlSchemaCompletionCollection schemas)
 {
     List<string> fileNames = new List<string>();
     foreach (XmlSchemaCompletion schema in schemas) {
         fileNames.Add(schema.FileName);
     }
     return fileNames.ToArray();
 }
 public void Init()
 {
     schemas = new XmlSchemaCompletionCollection();
     defaultXmlSchemaFileExtensions = CreateDefaultXmlSchemaFileExtensions();
     properties   = new Properties();
     associations = new XmlSchemaFileAssociations(properties, defaultXmlSchemaFileExtensions, schemas);
     options      = new XmlEditorOptions(properties);
 }
		public void Init()
		{
			schemas = new XmlSchemaCompletionCollection();
			foreach (string schema in GetSchemas()) {
				StringReader reader = new StringReader(schema);
				schemas.Add(new XmlSchemaCompletion(reader));
			}
		}
		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, null);
			schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, xml.IndexOf("name"));
		}
 public void Init()
 {
     schemas = new XmlSchemaCompletionCollection();
     foreach (string schema in GetSchemas())
     {
         StringReader reader = new StringReader(schema);
         schemas.Add(new XmlSchemaCompletion(reader));
     }
 }
Ejemplo n.º 15
0
        public void SetUpFixture()
        {
            schemas = new XmlSchemaCompletionCollection();
            XmlSchemaCompletion completionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());

            expectedNamespace       = completionData.NamespaceUri;
            completionData.FileName = FileName.Create(@"C:\Schemas\MySchema.xsd");
            schemas.Add(completionData);
        }
        protected XmlSchemaCompletion GetDefaultSchema(XmlElementPath elementPath, XmlSchemaCompletionCollection schemas)
        {
            XmlSchemaCompletion defaultSchema = schemas[""];

            if (elementPath.Elements.Count > 0)
            {
                defaultSchema = schemas[elementPath.GetRootNamespace()]; //schemaFileAssociations.GetSchemaCompletion(editor.FileName);
            }
            return(defaultSchema);
        }
Ejemplo n.º 17
0
        public void GetSchemasForElementPathReturnsEmptyCollectionWhenNoNamespaceUsedInPathAndNoDefaultSchema()
        {
            XmlElementPath path = new XmlElementPath();

            path.AddElement(new QualifiedName("root", String.Empty));

            XmlSchemaCompletionCollection foundSchemas = schemas.GetSchemas(path, null);

            Assert.AreEqual(0, foundSchemas.Count);
        }
        public static string[] GetFileNames(XmlSchemaCompletionCollection schemas)
        {
            List <string> fileNames = new List <string>();

            foreach (XmlSchemaCompletion schema in schemas)
            {
                fileNames.Add(schema.FileName);
            }
            return(fileNames.ToArray());
        }
Ejemplo n.º 19
0
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            schemas.Add(SchemaCompletion);
            string xml = "<note xmlns='http://www.w3schools.com' name=''></note>";
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, null);

            schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, xml.IndexOf("name"));
        }
Ejemplo n.º 20
0
        public void GetSchemasForElementPathReturnsDuplicateFooSchemasWhenFooNamespaceUsedInPath()
        {
            XmlElementPath path = new XmlElementPath();

            path.AddElement(new QualifiedName("root", "foo"));

            XmlSchemaCompletionCollection foundSchemas = schemas.GetSchemas(path, null);

            string[] expectedFileNames = new string[] { "foo.xsd", "duplicate-foo.xsd" };
            Assert.AreEqual(expectedFileNames, XmlSchemaCompletionCollectionFileNames.GetFileNames(foundSchemas));
        }
		public void Init()
		{
			CreateBarSchema();
			CreateFooSchema();
			CreateDuplicateFooSchema();
			
			schemas = new XmlSchemaCompletionCollection();
			schemas.Add(fooSchema);
			schemas.Add(barSchema);
			schemas.Add(duplicateFooSchema);
		}
Ejemplo n.º 22
0
        public void Init()
        {
            CreateBarSchema();
            CreateFooSchema();
            CreateDuplicateFooSchema();

            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(fooSchema);
            schemas.Add(barSchema);
            schemas.Add(duplicateFooSchema);
        }
		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			
			string xml = "<note xmlns='http://www.w3schools.com'></note>";
			int index = xml.IndexOf("note xmlns");
			
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, null);
			schemaElement = (XmlSchemaElement)schemaDefinition.GetSelectedSchemaObject(xml, index);
			location = schemaDefinition.GetSelectedSchemaObjectLocation(xml, index);
		}
Ejemplo n.º 24
0
		public XmlTreeView(IViewContent parent, XmlSchemaCompletionCollection schemas, XmlSchemaCompletion defaultSchema)
			: base(parent)
		{
			this.schemas = schemas;
			this.defaultSchema = defaultSchema;
			
			this.TabPageText = "${res:ICSharpCode.XmlEditor.XmlTreeView.Title}";
			this.treeViewContainer = new XmlTreeViewContainerControl(schemas, defaultSchema);
			this.treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged;
			treeViewContainer.AttributesGrid.ContextMenuStrip = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/AttributesGrid/ContextMenu");
			treeViewContainer.TreeView.ContextMenuStrip = MenuService.CreateContextMenu(treeViewContainer, "/AddIns/XmlEditor/XmlTree/ContextMenu");
		}
		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			XmlSchemaCompletion xsdSchemaCompletionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			
			string xml = GetSchema();			
			int index = xml.IndexOf("ref=\"dir\"");
			index = xml.IndexOf("dir", index);
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
			schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, index);
		}
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
            schemas.Add(SchemaCompletion);
            XmlSchemaCompletion xsdSchemaCompletion = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
            schemas.Add(xsdSchemaCompletion);

            string xml = GetSchema();
            int index = xml.IndexOf("type=\"text-type\"");
            index = xml.IndexOf("text-type", index);
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
            schemaComplexType = (XmlSchemaComplexType)schemaDefinition.GetSelectedSchemaObject(xml, index);
        }
		public void FixtureInit()
		{
			XmlSchemaCompletionCollection items = new XmlSchemaCompletionCollection();
			
			StringReader reader = new StringReader(GetSchema(firstNamespace));
			XmlSchemaCompletion schema = new XmlSchemaCompletion(reader);
			items.Add(schema);
			
			reader = new StringReader(GetSchema(secondNamespace));
			schema = new XmlSchemaCompletion(reader);
			items.Add(schema);
			namespaceCompletionItems = items.GetNamespaceCompletion();
		}
Ejemplo n.º 28
0
		public XmlSchemasPanel(RegisteredXmlSchemas registeredXmlSchemas, 
			ICollection<string> xmlFileExtensions, 
			XmlSchemaFileAssociations fileAssociations,
			IXmlSchemaCompletionDataFactory factory)
		{
			this.predefinedSchemas = registeredXmlSchemas.Schemas;
			this.xmlFileExtensions = xmlFileExtensions;
			this.fileAssociations = fileAssociations;
			
			InitializeComponent();
			
			editor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, xmlFileExtensions, fileAssociations, this, factory);
		}
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            textEditor               = new MockTextEditor();
            textEditor.FileName      = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "";
            textEditor.Caret.Offset  = 0;

            completionBinding = new XmlCodeCompletionBinding(associations);
        }
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            textEditor = new MockTextEditor();
            textEditor.FileName = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "";
            textEditor.Caret.Offset = 0;

            completionBinding = new XmlCodeCompletionBinding(associations);
        }
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            schemas.Add(SchemaCompletion);

            string xml   = "<note xmlns='http://www.w3schools.com'></note>";
            int    index = xml.IndexOf("note xmlns");

            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, null);

            schemaElement = (XmlSchemaElement)schemaDefinition.GetSelectedSchemaObject(xml, index);
            location      = schemaDefinition.GetSelectedSchemaObjectLocation(xml, index);
        }
		public override void FixtureInit()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			schemas.Add(SchemaCompletion);
			XmlSchemaCompletion xsdSchemaCompletionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
			schemas.Add(xsdSchemaCompletionData);
			
			string xml = GetSchema();
			
			int index = xml.IndexOf("ref=\"xs:list");
			index = xml.IndexOf("xs", index);
			XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
			referencedSchemaElement = (XmlSchemaElement)schemaDefinition.GetSelectedSchemaObject(xml, index);
		}
Ejemplo n.º 33
0
        public void FixtureInit()
        {
            XmlSchemaCompletionCollection items = new XmlSchemaCompletionCollection();

            StringReader        reader = new StringReader(GetSchema(firstNamespace));
            XmlSchemaCompletion schema = new XmlSchemaCompletion(reader);

            items.Add(schema);

            reader = new StringReader(GetSchema(secondNamespace));
            schema = new XmlSchemaCompletion(reader);
            items.Add(schema);
            namespaceCompletionItems = items.GetNamespaceCompletion();
        }
Ejemplo n.º 34
0
        protected void InitBase()
        {
            schemas = new XmlSchemaCompletionCollection();
            AddSchemas();

            associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            textEditor = new MockTextEditor();
            textEditor.Document.Text = "<a xmlns></a>";
            textEditor.FileName      = new FileName(@"c:\projects\test.xml");

            // Put caret just after "xmlns".
            textEditor.Caret.Offset = 8;
        }
		protected void InitBase()
		{
			schemas = new XmlSchemaCompletionCollection();
			AddSchemas();

			associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
			
			textEditor = new MockTextEditor();
			textEditor.Document.Text = "<a xmlns></a>";
			textEditor.FileName = new FileName(@"c:\projects\test.xml");
			
			// Put caret just after "xmlns".
			textEditor.Caret.Offset = 8;			
		}		
Ejemplo n.º 36
0
        public void GetSchemasForElementPathReturnsDefaultSchemaWhenNoNamespaceUsedInPathButHasDefaultSchema()
        {
            XmlElementPath path = new XmlElementPath();

            path.AddElement(new QualifiedName("root", String.Empty));

            XmlSchemaCompletion defaultSchema = new XmlSchemaCompletion();

            defaultSchema.FileName = "default.xsd";

            XmlSchemaCompletionCollection foundSchemas = schemas.GetSchemas(path, defaultSchema);

            string[] expectedFileNames = new string[] { "default.xsd" };
            Assert.AreEqual(expectedFileNames, XmlSchemaCompletionCollectionFileNames.GetFileNames(foundSchemas));
        }
		public void Init()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
			
			textEditor = new MockTextEditor();
			textEditor.FileName = new FileName(@"c:\projects\test.xsd");
			textEditor.Document.Text = "<xs:schema elementFormDefault=\"\"></xs:schema>";
			
			// Put cursor inside the double quotes following the elementFormDefault attribute
			textEditor.Caret.Offset = 31;	
			
			completionBinding = new XmlCodeCompletionBinding(associations);
			result = completionBinding.CtrlSpace(textEditor);
		}
		public void Init()
		{
			fileSystem = new MockFileSystem();
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);
			panel = new MockXmlSchemasPanel();
			
			schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
			schemasEditor.LoadOptions();
						
			panel.OpenFileDialogFileNameToReturn = @"c:\temp\schema.xsd";
			panel.OpenFileDialogResultToReturn = true;
			
		}
		public void Init()
		{
			schemas = new XmlSchemaCompletionCollection();
			schemas.Add(new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema()));

			XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
			associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://www.w3.org/1999/xhtml"));
			
			textEditor = new MockTextEditor();
			textEditor.Document.Text = String.Empty;
			textEditor.FileName = new FileName(@"c:\projects\test.xml");
			
			textEditor.Caret.Offset = 0;
			
			completionBinding = new XmlCodeCompletionBinding(associations);
		}
Ejemplo n.º 40
0
        public void Init()
        {
            fileSystem           = new MockFileSystem();
            factory              = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
            XmlSchemaCompletionCollection schemas      = new XmlSchemaCompletionCollection();
            XmlSchemaFileAssociations     associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);

            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
            schemasEditor.LoadOptions();

            panel.OpenFileDialogFileNameToReturn = @"c:\temp\schema.xsd";
            panel.OpenFileDialogResultToReturn   = true;
        }
Ejemplo n.º 41
0
        public void Init()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            textEditor               = new MockTextEditor();
            textEditor.FileName      = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "<xs:schema elementFormDefault=\"\"></xs:schema>";

            // Put cursor inside the double quotes following the elementFormDefault attribute
            textEditor.Caret.Offset = 31;

            completionBinding = new XmlCodeCompletionBinding(associations);
            result            = completionBinding.CtrlSpace(textEditor);
        }
Ejemplo n.º 42
0
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            schemas.Add(SchemaCompletion);
            XmlSchemaCompletion xsdSchemaCompletionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());

            schemas.Add(xsdSchemaCompletionData);

            string xml   = GetSchema();
            int    index = xml.IndexOf("ref=\"dir\"");

            index = xml.IndexOf("dir", index);
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);

            schemaAttribute = (XmlSchemaAttribute)schemaDefinition.GetSelectedSchemaObject(xml, index);
        }
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema()));

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xml", "http://www.w3.org/1999/xhtml"));

            textEditor = new MockTextEditor();
            textEditor.Document.Text = String.Empty;
            textEditor.FileName      = new FileName(@"c:\projects\test.xml");

            textEditor.Caret.Offset = 0;

            completionBinding = new XmlCodeCompletionBinding(associations);
        }
		public void Init()
		{
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
							
			XmlSchemaCompletion xhtmlSchema = new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema());
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			
			treeViewContainer.LoadXml("<html><body></body></html>", schemas, null);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0];
			htmlTreeNode.Expanding();
			bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0];
			
			bodyElement = (XmlElement)doc.SelectSingleNode("/html/body");
		}
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            schemas.Add(SchemaCompletion);
            XmlSchemaCompletion xsdSchemaCompletion = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());

            schemas.Add(xsdSchemaCompletion);

            string xml   = GetSchema();
            int    index = xml.IndexOf("type=\"text-type\"");

            index = xml.IndexOf("text-type", index);
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);

            schemaComplexType = (XmlSchemaComplexType)schemaDefinition.GetSelectedSchemaObject(xml, index);
        }
Ejemplo n.º 46
0
        public override void FixtureInit()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            schemas.Add(SchemaCompletion);
            XmlSchemaCompletion xsdSchemaCompletionData = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());

            schemas.Add(xsdSchemaCompletionData);

            string xml = GetSchema();

            int index = xml.IndexOf("ref=\"xs:list");

            index = xml.IndexOf("xs", index);
            XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);

            referencedSchemaElement = (XmlSchemaElement)schemaDefinition.GetSelectedSchemaObject(xml, index);
        }
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(new XmlSchemaCompletion(ResourceManager.ReadXsdSchema()));

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xsd", "http://www.w3.org/2001/XMLSchema", "xs"));

            textEditor = new MockTextEditor();
            textEditor.FileName = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "<xs:schema></xs:schema>";

            // Put cursor after the first 'a' in "<xs:schema>"
            textEditor.Caret.Offset = 10;

            XmlCodeCompletionBinding completionBinding = new XmlCodeCompletionBinding(associations);
            keyPressResult = completionBinding.HandleKeyPress(textEditor, ' ');
        }
		public void Init()
		{
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			xsdSchema = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
			schemas.Add(xsdSchema);

			associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
			associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xsd", "http://www.w3.org/2001/XMLSchema", "xs"));
			
			textEditor = new MockTextEditor();
			textEditor.FileName = new FileName(@"c:\projects\test.xsd");
			textEditor.Document.Text = "<xs:schema elementFormDefault=\"\"></xs:schema>";
			
			// Put cursor inside the double quotes following the elementFormDefault attribute
			textEditor.Caret.Offset = 31;	
			
			completionBinding = new XmlCodeCompletionBinding(associations);
			result = completionBinding.CtrlSpace(textEditor);
		}
        /// <summary>
        /// Automatically retrieve the xsds referenced on the xml
        /// </summary>
        /// <param name="xmlContent"></param>
        /// <returns></returns>
        protected XmlSchemaCompletionCollection AutoFindSchemaCollection()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
            List <String> xsds = XmlParser.GetAllXsdFileNamesFromXml(this.Text.Content);

            foreach (string xsd in xsds)
            {
                Uri xsdUri = new Uri(this.Text.Uri, xsd);

                if (File.Exists(xsdUri.LocalPath) == false)
                {
                    continue;
                }

                //string xsdPath = FileUtility.GetAbsolutePath(text.FileName.GetParentDirectory(), xsd);
                schemas.Add(new XmlSchemaCompletion(xsdUri));
            }
            return(schemas);
        }
        public void Init()
        {
            schemas = new XmlSchemaCompletionCollection();
            schemas.Add(new XmlSchemaCompletion(ResourceManager.ReadXsdSchema()));

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);

            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xsd", "http://www.w3.org/2001/XMLSchema", "xs"));

            textEditor               = new MockTextEditor();
            textEditor.FileName      = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "<xs:schema></xs:schema>";

            // Put cursor after the first 'a' in "<xs:schema>"
            textEditor.Caret.Offset = 10;

            XmlCodeCompletionBinding completionBinding = new XmlCodeCompletionBinding(associations);

            keyPressResult = completionBinding.HandleKeyPress(textEditor, ' ');
        }
        public void Init()
        {
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            xsdSchema = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
            schemas.Add(xsdSchema);

            associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(new AddInTreeNode()), schemas);
            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".xsd", "http://www.w3.org/2001/XMLSchema", "xs"));

            textEditor               = new MockTextEditor();
            textEditor.FileName      = new FileName(@"c:\projects\test.xsd");
            textEditor.Document.Text = "<xs:schema elementFormDefault=\"\"></xs:schema>";

            // Put cursor inside the double quotes following the elementFormDefault attribute
            textEditor.Caret.Offset = 31;

            completionBinding = new XmlCodeCompletionBinding(associations);
            result            = completionBinding.CtrlSpace(textEditor);
        }
		public void SetUp()
		{
			MockOpenedFile openedFile = new MockOpenedFile("test.xml");
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			xmlView = new MockXmlViewContent(openedFile);
			view = new XmlTreeView(xmlView, schemas, null);
			treeViewContainer = (XmlTreeViewContainerControl)view.Control;
			treeView = treeViewContainer.TreeView;
			clipboardHandler = view as IClipboardHandler;
			xmlView.GetDocumentForFile(null).Text = "<html><body><p></p></body></html>";
			openedFile.SwitchToView(view);
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.Nodes[0] as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			paragraphTreeNode = bodyTreeNode.Nodes[0] as XmlElementTreeNode;

			treeView.SelectedNode = null;
		}
		public void Init()
		{
			fileSystem = new MockFileSystem();
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);
			panel = new MockXmlSchemasPanel();
			
			schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
			schemasEditor.LoadOptions();
			
			newXmlSchemaFileName = @"c:\projects\a.xsd";
			factory.AddSchemaXml(newXmlSchemaFileName, 
				"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");
			
			panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
			panel.OpenFileDialogResultToReturn = true;
			
			schemasEditor.AddSchemaFromFileSystem();
		}
Ejemplo n.º 54
0
        public void SetUp()
        {
            MockOpenedFile openedFile             = new MockOpenedFile("test.xml");
            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();

            xmlView           = new MockXmlViewContent(openedFile);
            view              = new XmlTreeView(xmlView, schemas, null);
            treeViewContainer = (XmlTreeViewContainerControl)view.Control;
            treeView          = treeViewContainer.TreeView;
            clipboardHandler  = view as IClipboardHandler;
            xmlView.GetDocumentForFile(null).Text = "<html><body><p></p></body></html>";
            openedFile.SwitchToView(view);

            htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
            htmlTreeNode.PerformInitialization();
            bodyTreeNode = htmlTreeNode.Nodes[0] as XmlElementTreeNode;
            bodyTreeNode.PerformInitialization();
            paragraphTreeNode = bodyTreeNode.Nodes[0] as XmlElementTreeNode;

            treeView.SelectedNode = null;
        }
        public void Init()
        {
            fileSystem           = new MockFileSystem();
            factory              = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);

            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
            string testSchemaXml       = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";
            XmlSchemaCompletion schema = new XmlSchemaCompletion(new StringReader(testSchemaXml));

            schema.IsReadOnly = false;
            schemas.Add(schema);

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);

            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".test", "http://test"));
            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[] { ".test" }, associations, panel, factory);
            schemasEditor.LoadOptions();

            string newXmlSchemaFileName = @"c:\projects\new.xsd";
            string newSchemaXml         = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://new' />";

            factory.AddSchemaXml(newXmlSchemaFileName, newSchemaXml);

            panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
            panel.OpenFileDialogResultToReturn   = true;

            // Add schema from file system to ensure that the list of schemas shown to the
            // user is from the list of schemas in the list box when changing the association
            // to a file extension
            schemasEditor.AddSchemaFromFileSystem();

            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;
            schemasEditor.XmlSchemaFileAssociationFileExtensionSelectionChanged();

            panel.SelectXmlSchemaWindowDialogResultToReturn = false;
            schemasEditor.ChangeSchemaAssociation();
        }
		public void Init()
		{
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
			treeViewContainer.DirtyChanged += TreeViewContainerDirtyChanged;
							
			XmlSchemaCompletion xhtmlSchema = new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema());
			schemas = new XmlSchemaCompletionCollection();
			
			treeViewContainer.LoadXml("<html id='a'>text<body></body></html>", schemas, null);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[0];
			htmlTreeNode.Expanding();
			textTreeNode = (XmlTextTreeNode)htmlTreeNode.Nodes[0];

			splitContainer = (SplitContainer)treeViewContainer.Controls["splitContainer"];
			
			textBox = (RichTextBox)splitContainer.Panel2.Controls["textBox"];
			errorMessageTextBox = (RichTextBox)splitContainer.Panel2.Controls["errorMessageTextBox"];
			attributesGrid = (PropertyGrid)splitContainer.Panel2.Controls["attributesGrid"];
		}
Ejemplo n.º 57
0
        public void Init()
        {
            fileSystem           = new MockFileSystem();
            factory              = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
            XmlSchemaCompletionCollection schemas      = new XmlSchemaCompletionCollection();
            XmlSchemaFileAssociations     associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);

            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
            schemasEditor.LoadOptions();

            newXmlSchemaFileName = @"c:\projects\a.xsd";
            factory.AddSchemaXml(newXmlSchemaFileName,
                                 "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");

            panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
            panel.OpenFileDialogResultToReturn   = true;

            schemasEditor.AddSchemaFromFileSystem();
        }
		public void Init()
		{
			treeViewContainer = new XmlTreeViewContainerControl();
							
			XmlSchemaCompletion xhtmlSchema = new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema());
			XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
			
			treeViewContainer.LoadXml("<!-- comment --><html><body class='a'><p>Text</p></body></html>", schemas, null);
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			commentTreeNode = (XmlCommentTreeNode)treeView.Nodes[0];
			htmlTreeNode = (XmlElementTreeNode)treeView.Nodes[1];
			htmlTreeNode.Expanding();
			
			bodyTreeNode = (XmlElementTreeNode)htmlTreeNode.Nodes[0];
			bodyTreeNode.Expanding();
			
			paraTreeNode = (XmlElementTreeNode)bodyTreeNode.Nodes[0];
			paraTreeNode.Expanding();
			
			textTreeNode = (XmlTextTreeNode)paraTreeNode.Nodes[0];
		}
        public void Init()
        {
            fileSystem = new MockFileSystem();
            factory = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);

            XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
            string testSchemaXml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";
            XmlSchemaCompletion schema = new XmlSchemaCompletion(new StringReader(testSchemaXml));
            schema.IsReadOnly = false;
            schemas.Add(schema);

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);
            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".test", "http://test"));
            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[] { ".test" }, associations, panel, factory);
            schemasEditor.LoadOptions();

            string newXmlSchemaFileName = @"c:\projects\new.xsd";
            string newSchemaXml = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://new' />";
            factory.AddSchemaXml(newXmlSchemaFileName, newSchemaXml);

            panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
            panel.OpenFileDialogResultToReturn = true;

            // Add schema from file system to ensure that the list of schemas shown to the
            // user is from the list of schemas in the list box when changing the association
            // to a file extension
            schemasEditor.AddSchemaFromFileSystem();

            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;
            schemasEditor.XmlSchemaFileAssociationFileExtensionSelectionChanged();

            panel.SelectXmlSchemaWindowDialogResultToReturn = false;
            schemasEditor.ChangeSchemaAssociation();
        }
		public void Init()
		{
			schemas = new XmlSchemaCompletionCollection();
		}