コード例 #1
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaSimpleContentExtension extension)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      data.AddRange(GetAttributeCompletionData(extension.Attributes));

      return data;
    }
コード例 #2
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaObjectCollection attributes)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      foreach (XmlSchemaObject schemaObject in attributes)
      {
        XmlSchemaAttribute attribute = schemaObject as XmlSchemaAttribute;
        XmlSchemaAttributeGroupRef attributeGroupRef = schemaObject as XmlSchemaAttributeGroupRef;
        if (attribute != null)
        {
          if (!IsProhibitedAttribute(attribute))
          {
            AddAttribute(data, attribute);
          }
          else
          {
            prohibitedAttributes.Add(attribute);
          }
        }
        else if (attributeGroupRef != null)
        {
          data.AddRange(GetAttributeCompletionData(attributeGroupRef));
        }
      }
      return data;
    }
コード例 #3
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaComplexContentExtension extension)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      data.AddRange(GetAttributeCompletionData(extension.Attributes));
      XmlSchemaComplexType baseComplexType = FindNamedType(schema, extension.BaseTypeName);
      if (baseComplexType != null)
      {
        data.AddRange(GetAttributeCompletionData(baseComplexType));
      }

      return data;
    }
コード例 #4
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaSimpleContent simpleContent)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      XmlSchemaSimpleContentExtension extension = simpleContent.Content as XmlSchemaSimpleContentExtension;
      if (extension != null)
      {
        data.AddRange(GetAttributeCompletionData(extension));
      }

      return data;
    }
コード例 #5
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaElement element)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      XmlSchemaComplexType complexType = GetElementAsComplexType(element);

      if (complexType != null)
      {
        data.AddRange(GetAttributeCompletionData(complexType));
      }

      return data;
    }
コード例 #6
0
    XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaComplexType complexType)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      data = GetAttributeCompletionData(complexType.Attributes);

      // Add any complex content attributes.
      XmlSchemaComplexContent complexContent = complexType.ContentModel as XmlSchemaComplexContent;
      if (complexContent != null)
      {
        XmlSchemaComplexContentExtension extension = complexContent.Content as XmlSchemaComplexContentExtension;
        XmlSchemaComplexContentRestriction restriction = complexContent.Content as XmlSchemaComplexContentRestriction;
        if (extension != null)
        {
          data.AddRange(GetAttributeCompletionData(extension));
        }
        else if (restriction != null)
        {
          data.AddRange(GetAttributeCompletionData(restriction));
        }
      }
      else
      {
        XmlSchemaSimpleContent simpleContent = complexType.ContentModel as XmlSchemaSimpleContent;
        if (simpleContent != null)
        {
          data.AddRange(GetAttributeCompletionData(simpleContent));
        }
      }

      return data;
    }
コード例 #7
0
    XmlCompletionDataCollection GetChildElementCompletionData(XmlSchemaObjectCollection items, string prefix)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      foreach (XmlSchemaObject schemaObject in items)
      {

        XmlSchemaElement childElement = schemaObject as XmlSchemaElement;
        XmlSchemaSequence childSequence = schemaObject as XmlSchemaSequence;
        XmlSchemaChoice childChoice = schemaObject as XmlSchemaChoice;
        XmlSchemaGroupRef groupRef = schemaObject as XmlSchemaGroupRef;
        XmlSchemaAny anyRef = schemaObject as XmlSchemaAny;

        if (childElement != null)
        {
          string name = childElement.Name;
          if (name == null)
          {
            name = childElement.RefName.Name;
            XmlSchemaElement element = FindElement(childElement.RefName);
            if (element != null)
            {
              if (element.IsAbstract)
              {
                AddSubstitionGroupElements(data, element.QualifiedName, prefix);
              }
              else
              {
                AddElement(data, name, prefix, element.Annotation ?? element.ElementSchemaType.Annotation);
              }
            }
            else
            {
              AddElement(data, name, prefix, childElement.Annotation ?? childElement.ElementSchemaType.Annotation);
            }
          }
          else
          {
            AddElement(data, name, prefix, childElement.Annotation ?? childElement.ElementSchemaType.Annotation);
          }
        }
        else if (childSequence != null)
        {
          AddElements(data, GetChildElementCompletionData(childSequence.Items, prefix));
        }
        else if (childChoice != null)
        {
          AddElements(data, GetChildElementCompletionData(childChoice.Items, prefix));
        }
        else if (groupRef != null)
        {
          AddElements(data, GetChildElementCompletionData(groupRef, prefix));
        }
        else if (anyRef != null)
        {
          if (string.IsNullOrEmpty(anyRef.Namespace) || anyRef.Namespace == schema.TargetNamespace)
          {
            data.AddRange(GetElementCompletionData(prefix).OfType<XmlCompletionData>().ToArray());
          }
          else if (RelatedSchemas != null)
          {
            var completion = RelatedSchemas[anyRef.Namespace];
            if (completion != null)
            {
              completion._namespaces = _namespaces;
              data.AddRange(completion.GetElementCompletionData(null).OfType<XmlCompletionData>().ToArray());
            }
          }
        }
      }

      return data;
    }
コード例 #8
0
    XmlCompletionDataCollection GetChildElementCompletionData(XmlSchemaComplexContentExtension extension, string prefix)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      XmlSchemaComplexType complexType = FindNamedType(schema, extension.BaseTypeName);
      if (complexType != null)
      {
        data = GetChildElementCompletionData(complexType, prefix);
      }

      // Add any elements.
      if (extension.Particle != null)
      {
        XmlSchemaSequence sequence = extension.Particle as XmlSchemaSequence;
        XmlSchemaChoice choice = extension.Particle as XmlSchemaChoice;
        XmlSchemaGroupRef groupRef = extension.Particle as XmlSchemaGroupRef;

        if (sequence != null)
        {
          data.AddRange(GetChildElementCompletionData(sequence.Items, prefix));
        }
        else if (choice != null)
        {
          data.AddRange(GetChildElementCompletionData(choice.Items, prefix));
        }
        else if (groupRef != null)
        {
          data.AddRange(GetChildElementCompletionData(groupRef, prefix));
        }
      }

      return data;
    }
コード例 #9
0
    XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaSimpleTypeList list)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      if (list.ItemType != null)
      {
        data.AddRange(GetAttributeValueCompletionData(list.ItemType));
      }
      else if (list.ItemTypeName != null)
      {
        XmlSchemaSimpleType simpleType = FindSimpleType(list.ItemTypeName);
        if (simpleType != null)
        {
          data.AddRange(GetAttributeValueCompletionData(simpleType));
        }
      }

      return data;
    }
コード例 #10
0
    XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaSimpleType simpleType)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      XmlSchemaSimpleTypeRestriction simpleTypeRestriction = simpleType.Content as XmlSchemaSimpleTypeRestriction;
      XmlSchemaSimpleTypeUnion union = simpleType.Content as XmlSchemaSimpleTypeUnion;
      XmlSchemaSimpleTypeList list = simpleType.Content as XmlSchemaSimpleTypeList;

      if (simpleTypeRestriction != null)
      {
        data.AddRange(GetAttributeValueCompletionData(simpleTypeRestriction));
      }
      else if (union != null)
      {
        data.AddRange(GetAttributeValueCompletionData(union));
      }
      else if (list != null)
      {
        data.AddRange(GetAttributeValueCompletionData(list));
      }

      return data;
    }
コード例 #11
0
    XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaSimpleTypeUnion union)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      foreach (XmlSchemaObject schemaObject in union.BaseTypes)
      {
        XmlSchemaSimpleType simpleType = schemaObject as XmlSchemaSimpleType;
        if (simpleType != null)
        {
          data.AddRange(GetAttributeValueCompletionData(simpleType));
        }
      }

      return data;
    }
コード例 #12
0
    XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaAttribute attribute)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      if (attribute.SchemaType != null)
      {
        XmlSchemaSimpleTypeRestriction simpleTypeRestriction = attribute.SchemaType.Content as XmlSchemaSimpleTypeRestriction;
        XmlSchemaSimpleTypeUnion simpleTypeUnion = attribute.SchemaType.Content as XmlSchemaSimpleTypeUnion;
        if (simpleTypeRestriction != null)
        {
          data.AddRange(GetAttributeValueCompletionData(simpleTypeRestriction));
        }
        else if (simpleTypeUnion != null)
        {
          data.AddRange(GetAttributeValueCompletionData(simpleTypeUnion));
        }
      }
      else if (attribute.AttributeSchemaType != null)
      {
        XmlSchemaSimpleType simpleType = attribute.AttributeSchemaType as XmlSchemaSimpleType;

        if (simpleType != null)
        {
          if (simpleType.Name == "boolean")
          {
            data.AddRange(GetBooleanAttributeValueCompletionData());
          }
          else
          {
            data.AddRange(GetAttributeValueCompletionData(simpleType));
          }
        }
      }
      else if (attribute.SchemaTypeName != null && attribute.SchemaTypeName.Name == "Boolean")
      {
        data.AddRange(GetBooleanAttributeValueCompletionData());
      }

      return data;
    }
コード例 #13
0
    XmlCompletionDataCollection GetAttributeValueCompletionData(XmlSchemaElement element, string name)
    {
      XmlCompletionDataCollection data = new XmlCompletionDataCollection();

      XmlSchemaComplexType complexType = GetElementAsComplexType(element);
      if (complexType != null)
      {
        XmlSchemaAttribute attribute = FindAttribute(complexType, name);
        if (attribute != null)
        {
          data.AddRange(GetAttributeValueCompletionData(attribute));
        }
      }

      return data;
    }