Merge pull request #1275 from ranma42/fix-lib64
[mono.git] / mcs / class / System.XML / System.Xml.Serialization / XmlAttributes.cs
index eddc9b0c3bdb72e9c1551b7deb6102ed0bf93a1a..410d586bbb191f59855f5a729c2b5ecc4b28507f 100644 (file)
@@ -66,7 +66,8 @@ namespace System.Xml.Serialization
                        {
                                if(obj is XmlAnyAttributeAttribute)
                                        xmlAnyAttribute = (XmlAnyAttributeAttribute) obj;
-                               else if(obj is XmlAnyElementAttribute)
+                               else
+                               if(obj is XmlAnyElementAttribute)
                                        xmlAnyElements.Add((XmlAnyElementAttribute) obj);
                                else if(obj is XmlArrayAttribute)
                                        xmlArray = (XmlArrayAttribute) obj;
@@ -93,6 +94,22 @@ namespace System.Xml.Serialization
                                else if(obj is XmlTypeAttribute)
                                        xmlType = (XmlTypeAttribute) obj;
                        }
+                       
+                       if (xmlIgnore) {
+                               xmlAnyAttribute = null;
+                               xmlAnyElements.Clear ();
+                               xmlArray = null;
+                               xmlArrayItems.Clear ();
+                               xmlAttribute = null;
+                               xmlChoiceIdentifier = null;
+                               xmlDefaultValue = null;
+                               xmlElements.Clear ();
+                               xmlEnum = null;
+                               xmlns = false;
+                               xmlRoot = null;
+                               xmlText = null;
+                               xmlType = null;
+                       }
                }
 
                #region public properties
@@ -107,6 +124,7 @@ namespace System.Xml.Serialization
                                xmlAnyAttribute = value;
                        }
                }
+
                public XmlAnyElementAttributes XmlAnyElements 
                {
                        get 
@@ -278,5 +296,22 @@ namespace System.Xml.Serialization
                                
                        sb.Append ("|");
                }
+
+               internal int? Order {
+                       get {
+                               int? order = null;
+                               if (XmlElements.Count > 0)
+                                       order = XmlElements.Order;
+                               else if (XmlArray != null)
+                                       order = XmlArray.Order;
+                               else if (XmlAnyElements.Count > 0)
+                                       order = XmlAnyElements.Order;
+                               return order;
+                       }
+               }
+               
+               internal int SortableOrder {
+                       get { return Order != null ? (int) Order : int.MinValue; }
+               }
        }
 }