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 ());
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);
}
set {
if (value == null)
throw new ArgumentNullException ("Name");
+ OnNameChanging (this);
name = value;
+ OnNameChanged (this);
}
}
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;
}
}
}
-#if MOONLIGHT || MOBILE || NET_4_0
+#if NET_4_0
public static XElement Load (Stream stream)
{
return Load (stream, LoadOptions.None);
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
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
WriteTo (writer);
}
-#if NET_4_0 || MOONLIGHT || MOBILE
+#if NET_4_0
public void Save (Stream stream)
{
Save (stream, SaveOptions.None);
void SetAttributeObject (XAttribute a)
{
+ OnAddingObject (a);
a = (XAttribute) XUtil.GetDetachedObject (a);
a.SetOwner (this);
if (attr_first == null) {
a.PreviousAttribute = attr_last;
attr_last = a;
}
+ OnAddedObject (a);
}
string LookupPrefix (string ns, XmlWriter w)