5 // John Donagher (john@webmeta.com)
7 // (C) 2002 John Donagher
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Reflection;
33 using System.ComponentModel;
35 namespace System.Xml.Serialization
38 /// Summary description for SoapAttributes.
40 public class SoapAttributes
42 private SoapAttributeAttribute soapAttribute;
43 private object soapDefaultValue = System.DBNull.Value;
44 private SoapElementAttribute soapElement;
45 private SoapEnumAttribute soapEnum;
46 private bool soapIgnore;
47 private SoapTypeAttribute soapType;
49 public SoapAttributes ()
53 public SoapAttributes (ICustomAttributeProvider provider)
55 object[] attributes = provider.GetCustomAttributes(false);
56 foreach(object obj in attributes)
58 if(obj is SoapAttributeAttribute)
59 soapAttribute = (SoapAttributeAttribute) obj;
60 else if(obj is DefaultValueAttribute)
61 soapDefaultValue = ((DefaultValueAttribute) obj).Value;
62 else if(obj is SoapElementAttribute)
63 soapElement = (SoapElementAttribute) obj;
64 else if(obj is SoapEnumAttribute)
65 soapEnum = (SoapEnumAttribute) obj;
66 else if(obj is SoapIgnoreAttribute)
68 else if(obj is SoapTypeAttribute)
69 soapType = (SoapTypeAttribute) obj;
73 public SoapAttributeAttribute SoapAttribute
75 get { return soapAttribute; }
76 set { soapAttribute = value; }
79 public object SoapDefaultValue
81 get { return soapDefaultValue; }
82 set { soapDefaultValue = value; }
85 public SoapElementAttribute SoapElement
87 get { return soapElement; }
88 set { soapElement = value; }
91 public SoapEnumAttribute SoapEnum
93 get { return soapEnum; }
94 set { soapEnum = value; }
97 public bool SoapIgnore
99 get { return soapIgnore; }
100 set { soapIgnore = value; }
103 public SoapTypeAttribute SoapType
105 get { return soapType; }
106 set { soapType = value; }
109 internal void AddKeyHash (System.Text.StringBuilder sb)
116 if (soapAttribute != null)
117 soapAttribute.AddKeyHash (sb);
119 if (soapElement != null)
120 soapElement.AddKeyHash (sb);
122 if (soapEnum != null)
123 soapEnum.AddKeyHash (sb);
125 if (soapType != null)
126 soapType.AddKeyHash (sb);
128 if (soapDefaultValue == null) {
131 else if (!(soapDefaultValue is System.DBNull)) {
132 string v = XmlCustomFormatter.ToXmlString (TypeTranslator.GetTypeData (soapDefaultValue.GetType()), soapDefaultValue);