Remove() public method

public Remove ( string identifier ) : void
identifier string
return void
Exemplo n.º 1
0
        void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns)
        {
            ElementAccessor accessor;

            if ((accessor = ImportArray(element, ns)) == null)
            {
                accessor = ImportElement(element, ns);
            }

            MemberMapping member = new MemberMapping();

            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified"))
            {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
            member.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence)
            {
                member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
            }
        }
Exemplo n.º 2
0
        private void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns)
        {
            ElementAccessor accessor;

            if ((accessor = ImportArray(element, ns)) == null)
            {
                accessor = ImportElement(element, ns);
            }

            MemberMapping member = new MemberMapping();

            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified", StringComparison.Ordinal))
            {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
            member.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence)
            {
                member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
            }

            if (element.MinOccurs == 0 && member.TypeDesc.IsValueType && !member.TypeDesc.HasIsEmpty)
            {
                member.CheckSpecified = SpecifiedAccessor.ReadWrite;
            }
        }
Exemplo n.º 3
0
        private void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns)
        {
            MemberMapping   mapping;
            ElementAccessor accessor = this.ImportArray(element, ns);

            if (accessor == null)
            {
                accessor = this.ImportElement(element, ns);
            }
            mapping = new MemberMapping {
                Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name)),
                Name = members.AddUnique(mapping.Name, mapping)
            };
            if (mapping.Name.EndsWith("Specified", StringComparison.Ordinal))
            {
                string name = mapping.Name;
                mapping.Name = members.AddUnique(mapping.Name, mapping);
                members.Remove(name);
            }
            mapping.TypeDesc = accessor.Mapping.TypeDesc;
            mapping.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence)
            {
                mapping.TypeDesc = mapping.TypeDesc.CreateArrayTypeDesc();
            }
            if (((element.MinOccurs == 0M) && mapping.TypeDesc.IsValueType) && !mapping.TypeDesc.HasIsEmpty)
            {
                mapping.CheckSpecified = SpecifiedAccessor.ReadWrite;
            }
        }
        void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns) {
            ElementAccessor accessor;
            if ((accessor = ImportArray(element, ns)) == null) {
                accessor = ImportElement(element, ns);
            }

            MemberMapping member = new MemberMapping();
            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified", StringComparison.Ordinal)) {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
            member.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence)
                member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();

            if (element.MinOccurs == 0 && member.TypeDesc.IsValueType && !member.TypeDesc.HasIsEmpty) {
                member.CheckSpecified = true;
            }
        }
Exemplo n.º 5
0
        void ImportElementMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, string ns, bool repeats) {
            XmlSchemaElement abstractElement = GetAbstractElement(element);
            if (abstractElement != null) {
                ImportAbstractMember(abstractElement, identifier, members, ns, repeats);
                return;
            }
            ElementAccessor accessor;
            if ((accessor = ImportArray(element, identifier, ns, repeats)) == null) {
                if ((accessor = ImportSerializable(element, identifier, ns, repeats)) == null) {
                    accessor = ImportElement(element, identifier, typeof(TypeMapping), null, ns);
                }
            }

            MemberMapping member = new MemberMapping();
            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified")) {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
            member.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence || repeats)
                member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();

            if (element.MinOccurs == 0 && member.TypeDesc.IsValueType && !element.HasDefault && !member.TypeDesc.HasIsEmpty) {
                member.CheckSpecified = true;
            }
        }
Exemplo n.º 6
0
        void ImportAttributeMember(XmlSchemaAttribute attribute, string identifier, CodeIdentifiers members, string ns) {
            AttributeAccessor accessor = ImportAttribute(attribute, identifier, ns);
            if (accessor == null) return;
            MemberMapping member = new MemberMapping();
            member.Elements = new ElementAccessor[0];
            member.Attribute = accessor;
            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified")) {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = accessor.IsList ? accessor.Mapping.TypeDesc.CreateArrayTypeDesc() : accessor.Mapping.TypeDesc;

            if ((attribute.Use == XmlSchemaUse.Optional || attribute.Use == XmlSchemaUse.None) && member.TypeDesc.IsValueType && !attribute.HasDefault && !member.TypeDesc.HasIsEmpty) {
                member.CheckSpecified = true;
            }
        }
Exemplo n.º 7
0
        private void ImportElementMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool repeats, ref bool needExplicitOrder, bool allowDuplicates, bool allowUnboundedElements)
        {
            repeats = repeats | element.IsMultipleOccurrence;
            XmlSchemaElement headElement = GetTopLevelElement(element);
            if (headElement != null && ImportSubstitutionGroupMember(headElement, identifier, members, membersScope, ns, repeats, ref needExplicitOrder, allowDuplicates))
            {
                return;
            }
            ElementAccessor accessor;
            if ((accessor = ImportArray(element, identifier, ns, repeats)) == null)
            {
                accessor = ImportElement(element, identifier, typeof(TypeMapping), null, ns, false);
            }

            MemberMapping member = new MemberMapping();
            string name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = membersScope.AddUnique(name, member);

            if (member.Name.EndsWith("Specified", StringComparison.Ordinal))
            {
                name = member.Name;
                member.Name = membersScope.AddUnique(member.Name, member);
                membersScope.Remove(name);
            }
            members.Add(member.Name, member);
            // we do not support lists for elements
            if (accessor.Mapping.IsList)
            {
                accessor.Mapping = GetDefaultMapping(TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue);
                member.TypeDesc = accessor.Mapping.TypeDesc;
            }
            else
            {
                member.TypeDesc = accessor.Mapping.TypeDesc;
            }

            AddScopeElement(elementsScope, accessor, ref needExplicitOrder, allowDuplicates);
            member.Elements = new ElementAccessor[] { accessor };

            if (element.IsMultipleOccurrence || repeats)
            {
                if (!allowUnboundedElements && accessor.Mapping is ArrayMapping)
                {
                    accessor.Mapping = ((ArrayMapping)accessor.Mapping).TopLevelMapping;
                    accessor.Mapping.ReferencedByTopLevelElement = false;
                    accessor.Mapping.ReferencedByElement = true;
                }
                member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc();
            }

            if (element.MinOccurs == 0 && member.TypeDesc.IsValueType && !element.HasDefault && !member.TypeDesc.HasIsEmpty)
            {
                member.CheckSpecified = SpecifiedAccessor.ReadWrite;
            }
        }
 private void ImportAttributeMember(XmlSchemaAttribute attribute, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, string ns)
 {
     AttributeAccessor accessor = this.ImportAttribute(attribute, identifier, ns, attribute);
     if (accessor != null)
     {
         MemberMapping mapping;
         mapping = new MemberMapping {
             Elements = new ElementAccessor[0],
             Attribute = accessor,
             Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name)),
             Name = membersScope.AddUnique(mapping.Name, mapping)
         };
         if (mapping.Name.EndsWith("Specified", StringComparison.Ordinal))
         {
             string name = mapping.Name;
             mapping.Name = membersScope.AddUnique(mapping.Name, mapping);
             membersScope.Remove(name);
         }
         members.Add(mapping.Name, mapping);
         mapping.TypeDesc = accessor.IsList ? accessor.Mapping.TypeDesc.CreateArrayTypeDesc() : accessor.Mapping.TypeDesc;
         if (((attribute.Use == XmlSchemaUse.Optional) || (attribute.Use == XmlSchemaUse.None)) && ((mapping.TypeDesc.IsValueType && !attribute.HasDefault) && !mapping.TypeDesc.HasIsEmpty))
         {
             mapping.CheckSpecified = SpecifiedAccessor.ReadWrite;
         }
     }
 }
Exemplo n.º 9
0
        void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns) {
            ElementAccessor accessor;
            if ((accessor = ImportArray(element, ns)) == null) {
                accessor = ImportElement(element, ns);
            }

            MemberMapping member = new MemberMapping();
            member.Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name));
            member.Name = members.AddUnique(member.Name, member);
            if (member.Name.EndsWith("Specified")) {
                string name = member.Name;
                member.Name = members.AddUnique(member.Name, member);
                members.Remove(name);
            }
            member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
            member.Elements = new ElementAccessor[] { accessor };
            if (element.IsMultipleOccurrence)
                member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
        }
 private void ImportElementMember(XmlSchemaElement element, CodeIdentifiers members, string ns)
 {
     MemberMapping mapping;
     ElementAccessor accessor = this.ImportArray(element, ns);
     if (accessor == null)
     {
         accessor = this.ImportElement(element, ns);
     }
     mapping = new MemberMapping {
         Name = CodeIdentifier.MakeValid(Accessor.UnescapeName(accessor.Name)),
         Name = members.AddUnique(mapping.Name, mapping)
     };
     if (mapping.Name.EndsWith("Specified", StringComparison.Ordinal))
     {
         string name = mapping.Name;
         mapping.Name = members.AddUnique(mapping.Name, mapping);
         members.Remove(name);
     }
     mapping.TypeDesc = accessor.Mapping.TypeDesc;
     mapping.Elements = new ElementAccessor[] { accessor };
     if (element.IsMultipleOccurrence)
     {
         mapping.TypeDesc = mapping.TypeDesc.CreateArrayTypeDesc();
     }
     if (((element.MinOccurs == 0M) && mapping.TypeDesc.IsValueType) && !mapping.TypeDesc.HasIsEmpty)
     {
         mapping.CheckSpecified = SpecifiedAccessor.ReadWrite;
     }
 }