public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping)
 {
     xmlMembersMapping.CheckShallow();
     base.CheckScope(xmlMembersMapping.Scope);
     for (int i = 0; i < xmlMembersMapping.Count; i++)
     {
         AccessorMapping mapping = xmlMembersMapping[i].Mapping;
         if (mapping.Xmlns == null)
         {
             if (mapping.Attribute != null)
             {
                 this.ExportType(mapping.Attribute.Mapping, Accessor.UnescapeName(mapping.Attribute.Name), mapping.Attribute.Namespace, null, false);
             }
             if (mapping.Elements != null)
             {
                 for (int j = 0; j < mapping.Elements.Length; j++)
                 {
                     ElementAccessor accessor = mapping.Elements[j];
                     this.ExportType(accessor.Mapping, Accessor.UnescapeName(accessor.Name), accessor.Namespace, null, false);
                 }
             }
             if (mapping.Text != null)
             {
                 this.ExportType(mapping.Text.Mapping, Accessor.UnescapeName(mapping.Text.Name), mapping.Text.Namespace, null, false);
             }
         }
     }
 }
Пример #2
0
 internal bool Match(AccessorMapping mapping)
 {
     if (Elements != null && Elements.Length > 0)
     {
         if (!ElementsMatch(Elements, mapping.Elements))
         {
             return(false);
         }
         if (Text == null)
         {
             return(mapping.Text == null);
         }
     }
     if (Attribute != null)
     {
         if (mapping.Attribute == null)
         {
             return(false);
         }
         return(Attribute.Name == mapping.Attribute.Name && Attribute.Namespace == mapping.Attribute.Namespace && Attribute.Form == mapping.Attribute.Form);
     }
     if (Text != null)
     {
         return(mapping.Text != null);
     }
     return(mapping.Accessor == null);
 }
Пример #3
0
 protected AccessorMapping(AccessorMapping mapping)
     : base(mapping)
 {
     _typeDesc         = mapping._typeDesc;
     _attribute        = mapping._attribute;
     _elements         = mapping._elements;
     _sortedElements   = mapping._sortedElements;
     _text             = mapping._text;
     _choiceIdentifier = mapping._choiceIdentifier;
     _xmlns            = mapping._xmlns;
     _ignore           = mapping._ignore;
 }
Пример #4
0
 protected AccessorMapping(AccessorMapping mapping)
     : base(mapping)
 {
     this.typeDesc         = mapping.typeDesc;
     this.attribute        = mapping.attribute;
     this.elements         = mapping.elements;
     this.sortedElements   = mapping.sortedElements;
     this.text             = mapping.text;
     this.choiceIdentifier = mapping.choiceIdentifier;
     this.xmlns            = mapping.xmlns;
     this.ignore           = mapping.ignore;
 }
Пример #5
0
 internal bool Match(AccessorMapping mapping)
 {
     if ((this.Elements != null) && (this.Elements.Length > 0))
     {
         if (!ElementsMatch(this.Elements, mapping.Elements))
         {
             return(false);
         }
         if (this.Text == null)
         {
             return(mapping.Text == null);
         }
     }
     if (this.Attribute != null)
     {
         return(((mapping.Attribute != null) && ((this.Attribute.Name == mapping.Attribute.Name) && (this.Attribute.Namespace == mapping.Attribute.Namespace))) && (this.Attribute.Form == mapping.Attribute.Form));
     }
     if (this.Text != null)
     {
         return(mapping.Text != null);
     }
     return(mapping.Accessor == null);
 }
 internal bool Match(AccessorMapping mapping)
 {
     if ((this.Elements != null) && (this.Elements.Length > 0))
     {
         if (!ElementsMatch(this.Elements, mapping.Elements))
         {
             return false;
         }
         if (this.Text == null)
         {
             return (mapping.Text == null);
         }
     }
     if (this.Attribute != null)
     {
         return (((mapping.Attribute != null) && ((this.Attribute.Name == mapping.Attribute.Name) && (this.Attribute.Namespace == mapping.Attribute.Namespace))) && (this.Attribute.Form == mapping.Attribute.Form));
     }
     if (this.Text != null)
     {
         return (mapping.Text != null);
     }
     return (mapping.Accessor == null);
 }
Пример #7
0
        // UNDONE Nullable
        private void SetArrayMappingType(ArrayMapping mapping)
        {
            bool useDefaultNs = false;

            string itemTypeName;
            string itemTypeNamespace;

            TypeMapping itemTypeMapping;

            if (mapping.Elements.Length == 1)
            {
                itemTypeMapping = mapping.Elements[0].Mapping;
            }
            else
            {
                itemTypeMapping = null;
            }

            if (itemTypeMapping is EnumMapping)
            {
                itemTypeNamespace = itemTypeMapping.Namespace;
                itemTypeName      = itemTypeMapping.TypeName;
            }
            else if (itemTypeMapping is PrimitiveMapping)
            {
                itemTypeNamespace = itemTypeMapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
                itemTypeName      = itemTypeMapping.TypeDesc.DataType.Name;
                useDefaultNs      = true;
            }
            else if (itemTypeMapping is StructMapping)
            {
                if (itemTypeMapping.TypeDesc.IsRoot)
                {
                    itemTypeNamespace = XmlSchema.Namespace;
                    itemTypeName      = Soap.UrType;
                    useDefaultNs      = true;
                }
                else
                {
                    itemTypeNamespace = itemTypeMapping.Namespace;
                    itemTypeName      = itemTypeMapping.TypeName;
                }
            }
            else if (itemTypeMapping is ArrayMapping)
            {
                itemTypeNamespace = itemTypeMapping.Namespace;
                itemTypeName      = itemTypeMapping.TypeName;
            }
            else
            {
                throw new InvalidOperationException(SR.Format(SR.XmlInvalidSoapArray, mapping.TypeDesc.FullName));
            }

            itemTypeName = CodeIdentifier.MakePascal(itemTypeName);
            string      uniqueName      = "ArrayOf" + itemTypeName;
            string      ns              = useDefaultNs ? _defaultNs : itemTypeNamespace;
            int         i               = 1;
            TypeMapping existingMapping = (TypeMapping)_types[uniqueName, ns];

            while (existingMapping != null)
            {
                if (existingMapping is ArrayMapping)
                {
                    ArrayMapping arrayMapping = (ArrayMapping)existingMapping;
                    if (AccessorMapping.ElementsMatch(arrayMapping.Elements, mapping.Elements))
                    {
                        break;
                    }
                }
                // need to re-name the mapping
                uniqueName      = itemTypeName + i.ToString(CultureInfo.InvariantCulture);
                existingMapping = (TypeMapping)_types[uniqueName, ns];
                i++;
            }
            mapping.Namespace = ns;
            mapping.TypeName  = uniqueName;
        }
Пример #8
0
 internal bool Match(AccessorMapping mapping)
 {
     if (Elements != null && Elements.Length > 0)
     {
         if (!ElementsMatch(Elements, mapping.Elements))
         {
             return false;
         }
         if (Text == null)
         {
             return (mapping.Text == null);
         }
     }
     if (Attribute != null)
     {
         if (mapping.Attribute == null)
             return false;
         return (Attribute.Name == mapping.Attribute.Name && Attribute.Namespace == mapping.Attribute.Namespace && Attribute.Form == mapping.Attribute.Form);
     }
     if (Text != null)
     {
         return (mapping.Text != null);
     }
     return (mapping.Accessor == null);
 }
Пример #9
0
 protected AccessorMapping(AccessorMapping mapping)
     : base(mapping)
 {
     _typeDesc = mapping._typeDesc;
     _attribute = mapping._attribute;
     _elements = mapping._elements;
     _sortedElements = mapping._sortedElements;
     _text = mapping._text;
     _choiceIdentifier = mapping._choiceIdentifier;
     _xmlns = mapping._xmlns;
     _ignore = mapping._ignore;
 }
Пример #10
0
 protected AccessorMapping(AccessorMapping mapping)
     : base(mapping)
 {
     this.typeDesc = mapping.typeDesc;
     this.attribute = mapping.attribute;
     this.elements = mapping.elements;
     this.sortedElements = mapping.sortedElements;
     this.text = mapping.text;
     this.choiceIdentifier = mapping.choiceIdentifier;
     this.xmlns = mapping.xmlns;
     this.ignore = mapping.ignore;
 }
Пример #11
0
        private void SetArrayMappingType(ArrayMapping mapping)
        {
            string      typeName;
            string      str2;
            TypeMapping mapping2;
            bool        flag = false;

            if (mapping.Elements.Length == 1)
            {
                mapping2 = mapping.Elements[0].Mapping;
            }
            else
            {
                mapping2 = null;
            }
            if (mapping2 is EnumMapping)
            {
                str2     = mapping2.Namespace;
                typeName = mapping2.TypeName;
            }
            else if (mapping2 is PrimitiveMapping)
            {
                str2     = mapping2.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/";
                typeName = mapping2.TypeDesc.DataType.Name;
                flag     = true;
            }
            else if (mapping2 is StructMapping)
            {
                if (mapping2.TypeDesc.IsRoot)
                {
                    str2     = "http://www.w3.org/2001/XMLSchema";
                    typeName = "anyType";
                    flag     = true;
                }
                else
                {
                    str2     = mapping2.Namespace;
                    typeName = mapping2.TypeName;
                }
            }
            else
            {
                if (!(mapping2 is ArrayMapping))
                {
                    throw new InvalidOperationException(Res.GetString("XmlInvalidSoapArray", new object[] { mapping.TypeDesc.FullName }));
                }
                str2     = mapping2.Namespace;
                typeName = mapping2.TypeName;
            }
            typeName = CodeIdentifier.MakePascal(typeName);
            string      str3     = "ArrayOf" + typeName;
            string      str4     = flag ? this.defaultNs : str2;
            int         num      = 1;
            TypeMapping mapping3 = (TypeMapping)this.types[str3, str4];

            while (mapping3 != null)
            {
                if (mapping3 is ArrayMapping)
                {
                    ArrayMapping mapping4 = (ArrayMapping)mapping3;
                    if (AccessorMapping.ElementsMatch(mapping4.Elements, mapping.Elements))
                    {
                        break;
                    }
                }
                str3     = typeName + num.ToString(CultureInfo.InvariantCulture);
                mapping3 = (TypeMapping)this.types[str3, str4];
                num++;
            }
            mapping.Namespace = str4;
            mapping.TypeName  = str3;
        }