void GetAttributeValueCompletionData(XmlCompletionDataList data, XmlSchemaElement element, string name)
        {
            var complexType = GetElementAsComplexType(element);

            if (complexType != null)
            {
                var attribute = FindAttribute(complexType, name);
                if (attribute != null)
                {
                    GetAttributeValueCompletionData(data, attribute);
                }
            }
        }
        /// <summary>
        /// Gets the child element completion data for the xml element that exists
        /// at the end of the specified path.
        /// </summary>
        public CompletionDataList GetChildElementCompletionData(XmlElementPath path)
        {
            EnsureLoaded();

            var data    = new XmlCompletionDataList(path.Namespaces);
            var element = FindElement(path);

            if (element != null)
            {
                GetChildElementCompletionData(data, element, path.Elements.LastPrefix);
            }
            return(data);
        }
        public CompletionDataList GetChildElementCompletionData(string tagName)
        {
            EnsureLoaded();

            var list    = new XmlCompletionDataList();
            var element = FindElement(tagName);

            if (element != null)
            {
                GetChildElementCompletionData(list, element, "");
            }
            return(list);
        }
        public CompletionDataList GetAttributeValueCompletionData(string tagName, string name)
        {
            EnsureLoaded();

            var list    = new XmlCompletionDataList();
            var element = FindElement(tagName);

            if (element != null)
            {
                GetAttributeValueCompletionData(list, element, name);
            }
            return(list);
        }
        /// <summary>
        /// Gets the autocomplete data for the specified attribute value.
        /// </summary>
        public CompletionDataList GetAttributeValueCompletionData(XmlElementPath path, string name)
        {
            EnsureLoaded();

            var data    = new XmlCompletionDataList(path.Namespaces);
            var element = FindElement(path);

            if (element != null)
            {
                GetAttributeValueCompletionData(data, element, name);
            }
            return(data);
        }
        public CompletionDataList GetAttributeCompletionData(string tagName)
        {
            EnsureLoaded();

            var list    = new XmlCompletionDataList();
            var element = FindElement(tagName);

            if (element != null)
            {
                prohibitedAttributes.Clear();
                GetAttributeCompletionData(list, element);
            }
            return(list);
        }
        /// <summary>
        /// Gets the attribute completion data for the xml element that exists
        /// at the end of the specified path.
        /// </summary>
        public CompletionDataList GetAttributeCompletionData(XmlElementPath path)
        {
            EnsureLoaded();

            var data    = new XmlCompletionDataList(path.Namespaces);
            var element = FindElement(path);

            if (element != null)
            {
                prohibitedAttributes.Clear();
                GetAttributeCompletionData(data, element);
            }
            return(data);
        }
 void GetAttributeValueCompletionData(XmlCompletionDataList data, XmlSchemaSimpleTypeList list)
 {
     if (list.ItemType != null)
     {
         GetAttributeValueCompletionData(data, list.ItemType);
     }
     else if (list.ItemTypeName != null)
     {
         var simpleType = FindSimpleType(list.ItemTypeName);
         if (simpleType != null)
         {
             GetAttributeValueCompletionData(data, simpleType);
         }
     }
 }
        void GetChildElementCompletionData(XmlCompletionDataList data, XmlSchemaComplexContent complexContent, string prefix)
        {
            var extension = complexContent.Content as XmlSchemaComplexContentExtension;

            if (extension != null)
            {
                GetChildElementCompletionData(data, extension, prefix);
                return;
            }
            var restriction = complexContent.Content as XmlSchemaComplexContentRestriction;

            if (restriction != null)
            {
                GetChildElementCompletionData(data, restriction, prefix);
                return;
            }
        }
        /// <summary>
        /// Gets the possible root elements for an xml document using this schema.
        /// </summary>
        public CompletionDataList GetElementCompletionData(string namespacePrefix)
        {
            EnsureLoaded();

            var data = new XmlCompletionDataList();

            foreach (XmlSchemaElement element in schema.Elements.Values)
            {
                if (element.Name != null)
                {
                    data.AddElement(element.Name, namespacePrefix, element.Annotation);
                }
                else
                {
                    // Do not add reference element.
                }
            }
            return(data);
        }
 void GetAttributeValueCompletionData(XmlCompletionDataList data, XmlSchemaAttribute attribute)
 {
     if (attribute.SchemaType != null)
     {
         var simpleTypeRestriction = attribute.SchemaType.Content as XmlSchemaSimpleTypeRestriction;
         if (simpleTypeRestriction != null)
         {
             GetAttributeValueCompletionData(data, simpleTypeRestriction);
         }
     }
     else if (attribute.AttributeSchemaType != null)
     {
         if (attribute.AttributeSchemaType.TypeCode == XmlTypeCode.Boolean)
         {
             GetBooleanAttributeValueCompletionData(data);
         }
         else
         {
             GetAttributeValueCompletionData(data, attribute.AttributeSchemaType);
         }
     }
 }
        void GetChildElementCompletionData(XmlCompletionDataList data, XmlSchemaComplexType complexType, string prefix)
        {
            var sequence = complexType.Particle as XmlSchemaSequence;

            if (sequence != null)
            {
                GetChildElementCompletionData(data, sequence.Items, prefix);
                return;
            }
            var choice = complexType.Particle as XmlSchemaChoice;

            if (choice != null)
            {
                GetChildElementCompletionData(data, choice.Items, prefix);
                return;
            }
            var complexContent = complexType.ContentModel as XmlSchemaComplexContent;

            if (complexContent != null)
            {
                GetChildElementCompletionData(data, complexContent, prefix);
                return;
            }
            var groupRef = complexType.Particle as XmlSchemaGroupRef;

            if (groupRef != null)
            {
                GetChildElementCompletionData(data, groupRef, prefix);
                return;
            }
            var all = complexType.Particle as XmlSchemaAll;

            if (all != null)
            {
                GetChildElementCompletionData(data, all.Items, prefix);
                return;
            }
        }
        void GetChildElementCompletionData(XmlCompletionDataList data, XmlSchemaGroupRef groupRef, string prefix)
        {
            var group = FindGroup(groupRef.RefName.Name);

            if (group == null)
            {
                return;
            }
            var sequence = group.Particle as XmlSchemaSequence;

            if (sequence != null)
            {
                GetChildElementCompletionData(data, sequence.Items, prefix);
                return;
            }
            var choice = group.Particle as XmlSchemaChoice;

            if (choice != null)
            {
                GetChildElementCompletionData(data, choice.Items, prefix);
                return;
            }
        }
        void GetChildElementCompletionData(XmlCompletionDataList data, XmlSchemaComplexContentExtension extension, string prefix)
        {
            var complexType = FindNamedType(schema, extension.BaseTypeName);

            if (complexType != null)
            {
                GetChildElementCompletionData(data, complexType, prefix);
            }

            if (extension.Particle == null)
            {
                return;
            }

            var sequence = extension.Particle as XmlSchemaSequence;

            if (sequence != null)
            {
                GetChildElementCompletionData(data, sequence.Items, prefix);
                return;
            }
            var choice = extension.Particle as XmlSchemaChoice;

            if (choice != null)
            {
                GetChildElementCompletionData(data, choice.Items, prefix);
                return;
            }
            var groupRef = extension.Particle as XmlSchemaGroupRef;

            if (groupRef != null)
            {
                GetChildElementCompletionData(data, groupRef, prefix);
                return;
            }
        }
        void GetAttributeValueCompletionData(XmlCompletionDataList data, XmlSchemaSimpleType simpleType)
        {
            var xsstr = simpleType.Content as XmlSchemaSimpleTypeRestriction;

            if (xsstr != null)
            {
                GetAttributeValueCompletionData(data, xsstr);
                return;
            }
            var xsstu = simpleType.Content as XmlSchemaSimpleTypeUnion;

            if (xsstu != null)
            {
                GetAttributeValueCompletionData(data, xsstu);
                return;
            }
            var xsstl = simpleType.Content as XmlSchemaSimpleTypeList;

            if (xsstl != null)
            {
                GetAttributeValueCompletionData(data, xsstl);
                return;
            }
        }
Exemplo n.º 16
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaSimpleTypeRestriction simpleTypeRestriction)
		{
			foreach (XmlSchemaObject schemaObject in simpleTypeRestriction.Facets) {
				var enumFacet = schemaObject as XmlSchemaEnumerationFacet;
				if (enumFacet != null)
					data.AddAttributeValue (enumFacet.Value, enumFacet.Annotation);
			}
		}
Exemplo n.º 17
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaComplexContent complexContent, string prefix)
		{
			var extension = complexContent.Content as XmlSchemaComplexContentExtension;
			if (extension != null) {
				GetChildElementCompletionData (data, extension, prefix);
				return;
			}
			var restriction = complexContent.Content as XmlSchemaComplexContentRestriction;
			if (restriction != null) {
				GetChildElementCompletionData (data, restriction, prefix);
				return;
			}
		}
Exemplo n.º 18
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaSimpleTypeList list)
		{
			if (list.ItemType != null) {
				GetAttributeValueCompletionData (data, list.ItemType);
			} else if (list.ItemTypeName != null) {
				var simpleType = FindSimpleType (list.ItemTypeName);
				if (simpleType != null)
					GetAttributeValueCompletionData (data, simpleType);
			}
		}	
Exemplo n.º 19
0
		/// <summary>
		/// Adds any elements that have the specified substitution group.
		/// </summary>
		void AddSubstitionGroupElements (XmlCompletionDataList data, XmlQualifiedName group, string prefix)
		{
			foreach (XmlSchemaElement element in schema.Elements.Values)
				if (element.SubstitutionGroup == group)
					data.AddElement (element.Name, prefix, element.Annotation);
		}
Exemplo n.º 20
0
		public CompletionDataList GetAttributeCompletionData (string tagName)
		{
			EnsureLoaded ();
			
			var list = new XmlCompletionDataList ();
			var element = FindElement (tagName);
			if (element != null) {
				prohibitedAttributes.Clear();
				GetAttributeCompletionData (list, element);
			}
			return list;
		}
Exemplo n.º 21
0
		/// <summary>
		/// Gets the possible root elements for an xml document using this schema.
		/// </summary>
		public CompletionDataList GetElementCompletionData (string namespacePrefix)
		{
			EnsureLoaded ();
			
			var data = new XmlCompletionDataList ();
			foreach (XmlSchemaElement element in schema.Elements.Values) {
				if (element.Name != null) {
					data.AddElement (element.Name, namespacePrefix, element.Annotation);
				} else {
					// Do not add reference element.
				}
			}
			return data;
		}
Exemplo n.º 22
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaElement element, string prefix)
		{
			var complexType = GetElementAsComplexType (element);
			if (complexType != null)
				GetChildElementCompletionData (data, complexType, prefix);
		}
Exemplo n.º 23
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaElement element)
		{
			var complexType = GetElementAsComplexType (element);
			if (complexType != null)
				GetAttributeCompletionData (data, complexType);
		}	
Exemplo n.º 24
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaComplexType complexType, string prefix)
		{
			var sequence = complexType.Particle as XmlSchemaSequence;
			if (sequence != null) {
				GetChildElementCompletionData (data, sequence.Items, prefix);
				return;
			}
			var choice = complexType.Particle as XmlSchemaChoice;
			if (choice != null) {
				GetChildElementCompletionData (data, choice.Items, prefix);
				return;
			}
			var complexContent = complexType.ContentModel as XmlSchemaComplexContent;
			if (complexContent != null) {
				GetChildElementCompletionData (data, complexContent, prefix);
				return;
			}
			var groupRef = complexType.Particle as XmlSchemaGroupRef;
			if (groupRef != null) {
				GetChildElementCompletionData (data, groupRef, prefix);
				return;
			}
			var all = complexType.Particle as XmlSchemaAll;
			if (all != null) {
				GetChildElementCompletionData (data, all.Items, prefix);
				return;
			}
		}
Exemplo n.º 25
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaComplexContentRestriction restriction, string prefix)
		{
			if (restriction.Particle == null)
				return;
			var sequence = restriction.Particle as XmlSchemaSequence;
			if (sequence != null) {
				GetChildElementCompletionData (data, sequence.Items, prefix);
				return;
			}
			var choice = restriction.Particle as XmlSchemaChoice;
			if (choice != null) {
				GetChildElementCompletionData (data, choice.Items, prefix);
				return;
			}
			var groupRef = restriction.Particle as XmlSchemaGroupRef;
			if (groupRef != null) {
				GetChildElementCompletionData (data, groupRef, prefix);
				return;
			}
		}
Exemplo n.º 26
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaGroupRef groupRef, string prefix)
		{
			var group = FindGroup (groupRef.RefName.Name);
			if (group == null)
				return;
			var sequence = group.Particle as XmlSchemaSequence;
			if (sequence != null) {
				GetChildElementCompletionData (data, sequence.Items, prefix);
				return;
			}
			var choice = group.Particle as XmlSchemaChoice;
			if (choice != null) {
				GetChildElementCompletionData (data, choice.Items, prefix);
				return;
			}
		}		
Exemplo n.º 27
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaComplexContentExtension extension, string prefix)
		{
			var complexType = FindNamedType (schema, extension.BaseTypeName);
			if (complexType != null)
				GetChildElementCompletionData (data, complexType, prefix);
			
			if (extension.Particle == null)
				return;
			
			var sequence = extension.Particle as XmlSchemaSequence;
			if (sequence != null) {
				GetChildElementCompletionData (data, sequence.Items, prefix);
				return;
			}
			var choice = extension.Particle as XmlSchemaChoice;
			if (choice != null) {
				GetChildElementCompletionData (data, choice.Items, prefix);
				return;
			}
			var groupRef = extension.Particle as XmlSchemaGroupRef;
			if (groupRef != null) {
				GetChildElementCompletionData (data, groupRef, prefix);
				return;
			}
		}		
Exemplo n.º 28
0
		/// <summary>
		/// Gets the autocomplete data for the specified attribute value.
		/// </summary>
		public CompletionDataList GetAttributeValueCompletionData (XmlElementPath path, string name)
		{
			EnsureLoaded ();
			
			var data = new XmlCompletionDataList (path.Namespaces);
			var element = FindElement (path);
			if (element != null)
				GetAttributeValueCompletionData (data, element, name);
			return data;
		}
Exemplo n.º 29
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaSimpleType simpleType)
		{
			var xsstr = simpleType.Content as XmlSchemaSimpleTypeRestriction;
			if (xsstr != null) {
				GetAttributeValueCompletionData (data, xsstr);
				return;
			}
			var xsstu = simpleType.Content as XmlSchemaSimpleTypeUnion;
			if (xsstu != null) {
				GetAttributeValueCompletionData (data, xsstu);
				return;
			}
			var xsstl = simpleType.Content as XmlSchemaSimpleTypeList;
			if (xsstl != null) {
				GetAttributeValueCompletionData (data, xsstl);
				return;
			}
		}		
Exemplo n.º 30
0
		/// <summary>
		/// Gets the child element completion data for the xml element that exists
		/// at the end of the specified path.
		/// </summary>
		public CompletionDataList GetChildElementCompletionData (XmlElementPath path)
		{
			EnsureLoaded ();
			
			var data = new XmlCompletionDataList (path.Namespaces);
			var element = FindElement (path);
			if (element != null)
				GetChildElementCompletionData (data, element, path.Elements.LastPrefix);
			return data;
		}		
Exemplo n.º 31
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaSimpleContentExtension extension)
		{
			GetAttributeCompletionData (data, extension.Attributes);
		}		
Exemplo n.º 32
0
		/// <summary>
		/// Gets the attribute completion data for the xml element that exists
		/// at the end of the specified path.
		/// </summary>
		public CompletionDataList GetAttributeCompletionData (XmlElementPath path)
		{
			EnsureLoaded ();
			
			var data = new XmlCompletionDataList (path.Namespaces);
			var element = FindElement (path);
			if (element != null) {
				prohibitedAttributes.Clear ();
				GetAttributeCompletionData (data, element);
			}
			return data;
		}
Exemplo n.º 33
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaObjectCollection attributes)
		{
			foreach (XmlSchemaObject schemaObject in attributes) {
				var attribute = schemaObject as XmlSchemaAttribute;
				if (attribute != null) {
					if (!IsProhibitedAttribute(attribute)) {
						data.AddAttribute (attribute);
					} else {
						prohibitedAttributes.Add (attribute);
					}
				} else {
					var attributeGroupRef = schemaObject as XmlSchemaAttributeGroupRef;
					if (attributeGroupRef != null)
						GetAttributeCompletionData (data, attributeGroupRef);
				}
			}
		}
Exemplo n.º 34
0
		public CompletionDataList GetAttributeValueCompletionData (string tagName, string name)
		{
			EnsureLoaded ();
			
			var list = new XmlCompletionDataList ();
			var element = FindElement (tagName);
			if (element != null)
				GetAttributeValueCompletionData (list, element, name);
			return list;
		}
Exemplo n.º 35
0
		/// <summary>
		/// Gets attribute completion data from a group ref.
		/// </summary>
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaAttributeGroupRef groupRef)
		{
			var group = FindAttributeGroup (schema, groupRef.RefName.Name);
			if (group != null)
				GetAttributeCompletionData (data, group.Attributes);
		}
Exemplo n.º 36
0
		public CompletionDataList GetChildElementCompletionData (string tagName)
		{
			EnsureLoaded ();
			
			var list = new XmlCompletionDataList ();
			var element = FindElement (tagName);
			if (element != null)
				GetChildElementCompletionData (list, element, "");
			return list;
		}
Exemplo n.º 37
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaElement element, string name)
		{
			var complexType = GetElementAsComplexType (element);
			if (complexType != null) {
				var attribute = FindAttribute (complexType, name);
				if (attribute != null)
					GetAttributeValueCompletionData (data, attribute);
			}
		}
Exemplo n.º 38
0
		/// <summary>
		/// Gets the set of attribute values for an xs:boolean type.
		/// </summary>
		void GetBooleanAttributeValueCompletionData (XmlCompletionDataList data)
		{
			data.AddAttributeValue ("0");
			data.AddAttributeValue ("1");
			data.AddAttributeValue ("true");
			data.AddAttributeValue ("false");
		}
Exemplo n.º 39
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaAttribute attribute)
		{			
			if (attribute.SchemaType != null) {
				var simpleTypeRestriction = attribute.SchemaType.Content as XmlSchemaSimpleTypeRestriction;
				if (simpleTypeRestriction != null) {
					GetAttributeValueCompletionData (data, simpleTypeRestriction);
				}
			} else if (attribute.AttributeSchemaType != null) {
				if (attribute.AttributeSchemaType.TypeCode == XmlTypeCode.Boolean)
					GetBooleanAttributeValueCompletionData (data);
				else
					GetAttributeValueCompletionData (data, attribute.AttributeSchemaType);
			}
		}
Exemplo n.º 40
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaComplexType complexType)
		{
			GetAttributeCompletionData (data, complexType.Attributes);

			// Add any complex content attributes.
			var complexContent = complexType.ContentModel as XmlSchemaComplexContent;
			if (complexContent != null) {
				var extension = complexContent.Content as XmlSchemaComplexContentExtension;
				var restriction = complexContent.Content as XmlSchemaComplexContentRestriction;
				if (extension != null)
					GetAttributeCompletionData (data, extension);
				else if (restriction != null)
					GetAttributeCompletionData (data, restriction);
			} else {
				var simpleContent = complexType.ContentModel as XmlSchemaSimpleContent;
				if (simpleContent != null)
					GetAttributeCompletionData (data, simpleContent);
			}
		}
Exemplo n.º 41
0
		void GetChildElementCompletionData (XmlCompletionDataList data, XmlSchemaObjectCollection items, string prefix)
		{
			foreach (XmlSchemaObject schemaObject in items) {
				var childElement = schemaObject as XmlSchemaElement;
				if (childElement != null) {
					string name = childElement.Name;
					if (name == null) {
						name = childElement.RefName.Name;
						var element = FindElement (childElement.RefName);
						if (element != null) {
							if (element.IsAbstract) {
								AddSubstitionGroupElements (data, element.QualifiedName, prefix);
							} else {
								data.AddElement (name, prefix, element.Annotation);
							}
						} else {
							data.AddElement (name, prefix, childElement.Annotation);						
						}
					} else {
						data.AddElement (name, prefix, childElement.Annotation);
					}
					continue;
				}
				var childSequence = schemaObject as XmlSchemaSequence;
				if (childSequence != null) {
					GetChildElementCompletionData (data, childSequence.Items, prefix);
					continue;
				}
				var childChoice = schemaObject as XmlSchemaChoice;
				if (childChoice != null) {
					GetChildElementCompletionData (data, childChoice.Items, prefix);
					continue;
				}
				var groupRef = schemaObject as XmlSchemaGroupRef;
				if (groupRef != null) {
					GetChildElementCompletionData (data, groupRef, prefix);
					continue;
				}
			}
		}
Exemplo n.º 42
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaComplexContentExtension extension)
		{
			GetAttributeCompletionData (data, extension.Attributes);
			var baseComplexType = FindNamedType (schema, extension.BaseTypeName);
			if (baseComplexType != null)
				GetAttributeCompletionData (data, baseComplexType);
		}		
Exemplo n.º 43
0
		void GetAttributeCompletionData (XmlCompletionDataList data, XmlSchemaSimpleContent simpleContent)
		{
			var extension = simpleContent.Content as XmlSchemaSimpleContentExtension;
			if (extension != null)
				GetAttributeCompletionData (data, extension);
		}
 void GetAttributeCompletionData(XmlCompletionDataList data, XmlSchemaSimpleContentExtension extension)
 {
     GetAttributeCompletionData(data, extension.Attributes);
 }
Exemplo n.º 45
0
		void GetAttributeValueCompletionData (XmlCompletionDataList data, XmlSchemaSimpleTypeUnion union)
		{
			foreach (XmlSchemaObject schemaObject in union.BaseTypes) {
				var simpleType = schemaObject as XmlSchemaSimpleType;
				if (simpleType != null)
					GetAttributeValueCompletionData (data, simpleType);
			}
		}