Merge pull request #554 from deplinenoise/ppc_fixes
[mono.git] / mcs / class / System.Xml.Linq / System.Xml.Linq / XElement.cs
index 7bd4e5635d4bf8fcc60d6ace2e52e50e1fa7a4a9..80ba33b662332394e89f44393fbe7ea925b47263 100644 (file)
@@ -52,12 +52,16 @@ namespace System.Xml.Linq
 
                public XElement (XName name, object content)
                {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
                        this.name = name;
                        Add (content);
                }
 
                public XElement (XElement other)
                {
+                       if (other == null)
+                               throw new ArgumentNullException ("other");
                        name = other.name;
                        Add (other.Attributes ());
                        Add (other.Nodes ());
@@ -65,17 +69,23 @@ namespace System.Xml.Linq
 
                public XElement (XName name)
                {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
                        this.name = name;
                }
 
                public XElement (XName name, params object [] content)
                {
+                       if (name == null)
+                               throw new ArgumentNullException ("name");
                        this.name = name;
                        Add (content);
                }
 
                public XElement (XStreamingElement other)
                {
+                       if (other == null)
+                               throw new ArgumentNullException ("other");
                        this.name = other.Name;
                        Add (other.Contents);
                }
@@ -397,12 +407,7 @@ namespace System.Xml.Linq
 
                static void DefineDefaultSettings (XmlReaderSettings settings, LoadOptions options)
                {
-#if MOONLIGHT
-                       // 2.1 has a DtdProcessing property which defaults to DtdProcessing.Prohibit
-                       settings.DtdProcessing = DtdProcessing.Parse;
-#else
                        settings.ProhibitDtd = false;
-#endif
 
                        settings.IgnoreWhitespace = (options & LoadOptions.PreserveWhitespace) == 0;
                }
@@ -457,7 +462,7 @@ namespace System.Xml.Linq
                        }
                }
 
-#if MOONLIGHT || MOBILE || NET_4_0
+#if NET_4_0
                public static XElement Load (Stream stream)
                {
                        return Load (stream, LoadOptions.None);
@@ -539,7 +544,7 @@ namespace System.Xml.Linq
 
                        if ((options & SaveOptions.DisableFormatting) == SaveOptions.None)
                                s.Indent = true;
-#if NET_4_0 || MOONLIGHT || MOBILE
+#if NET_4_0
                        if ((options & SaveOptions.OmitDuplicateNamespaces) == SaveOptions.OmitDuplicateNamespaces)
                                s.NamespaceHandling |= NamespaceHandling.OmitDuplicates;
 #endif
@@ -559,7 +564,7 @@ namespace System.Xml.Linq
                        
                        if ((options & SaveOptions.DisableFormatting) == SaveOptions.None)
                                s.Indent = true;
-#if NET_4_0 || MOONLIGHT || MOBILE
+#if NET_4_0
                        if ((options & SaveOptions.OmitDuplicateNamespaces) == SaveOptions.OmitDuplicateNamespaces)
                                s.NamespaceHandling |= NamespaceHandling.OmitDuplicates;
 #endif
@@ -573,7 +578,7 @@ namespace System.Xml.Linq
                        WriteTo (writer);
                }
 
-#if NET_4_0 || MOONLIGHT || MOBILE
+#if NET_4_0
                public void Save (Stream stream)
                {
                        Save (stream, SaveOptions.None);