Enforce sanity checks on write operations.

Impose some minimal sanity checks on the input root node, including:
 . Its tag name must match with that of the target node;
 . If provided, its href must match with that of the target node,
   regardless of in absolute or relative format.

However, the input root node can safely omit the href attribute
at all, since the target node has been fully specified by the
request URI.
Since ref nodes can not be addressed by href, the node pointer will never have a chance to point to any ref node at all. So the check here is useless and not needed, and should be removed.