/// <summary>Removes the specified <see cref="AtomPubNode"/> from this node.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to remove.</param> /// <exception cref="ArgumentNullException"><paramref name="node"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="node"/> cannot be removed.</exception> public void Remove(AtomPubNode node) { if(node == null) throw new ArgumentNullException("node"); if(this.CanRemoveNode(node) == false) throw new ArgumentException(Errors.CannotRemoveNode, "node"); XElement element = (XElement)node; if(element.Parent == this.Element) element.Remove(); }
/// <summary>Returns a value indicating whether the specified <see cref="AtomPubNode"/> can be removed.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be removed; otherwise, false.</returns> protected override bool CanRemoveNode(AtomPubNode node) { return true; }
/// <summary>Returns a value indicating whether the specified <see cref="AtomPubNode"/> can be added.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be added; otherwise, false.</returns> protected override bool CanAddNode(AtomPubNode node) { return node is AtomPubWorkspace; }
/// <summary>Returns a value indicating whether the specified <see cref="AtomPubNode"/> can be added.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be added; otherwise, false.</returns> protected override bool CanAddNode(AtomPubNode node) { return node is AtomPubCollection; }
/// <summary>Adds the specified <see cref="AtomPubNode"/> to this node.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to add.</param> /// <exception cref="ArgumentNullException"><paramref name="node"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="node"/> cannot be added.</exception> public void Add(AtomPubNode node) { if(node == null) throw new ArgumentNullException("node"); if(this.CanAddNode(node) == false) throw new ArgumentException(Errors.CannotAddNode, "node"); this.Element.Add((XElement)node); }
/// <summary>When overridden in a derived class, returns a value indicating whether the specified <see cref="AtomPubNode"/> can be removed.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be removed; otherwise, false.</returns> protected abstract bool CanRemoveNode(AtomPubNode node);
/// <summary>When overridden in a derived class, returns a value indicating whether the specified <see cref="AtomPubNode"/> can be added.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be added; otherwise, false.</returns> protected abstract bool CanAddNode(AtomPubNode node);
/// <summary>Returns a value indicating whether the specified <see cref="AtomPubNode"/> can be added.</summary> /// <param name="node">The <see cref="AtomPubNode"/> to test.</param> /// <returns>True if the specified <see cref="AtomPubNode"/> can be added; otherwise, false.</returns> protected override bool CanAddNode(AtomPubNode node) { return node is AtomPubAccept || node is AtomPubCategories; }