void WritePossiblyTopLevelNode(XNode n, bool possiblyAttribute) { CheckState(); if (!possiblyAttribute && attribute != null) { throw new InvalidOperationException(String.Format("Current state is not acceptable for {0}.", n.NodeType)); } if (state != XmlNodeType.Element) { root.Add(n); } else if (attribute != null) { attribute.Value += XUtil.ToString(n); } else { current.Add(n); } if (state == XmlNodeType.None) { state = XmlNodeType.XmlDeclaration; } }
public void SetValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } this.value = XUtil.ToString(value); }
public void SetValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } OnValueChanging(this); this.value = XUtil.ToString(value); OnValueChanged(this); }
public void SetAttributeValue(XName name, object value) { XAttribute a = Attribute(name); if (value == null) { if (a != null) { a.Remove(); } } else { if (a == null) { SetAttributeObject(new XAttribute(name, value)); } else { a.Value = XUtil.ToString(value); } } }