DeleteSelf() public method

public DeleteSelf ( ) : void
return void
Example #1
0
        private void DeleteChildren()
        {
            switch (NodeType)
            {
            case XPathNodeType.Namespace:
                throw new InvalidOperationException("Removing namespace node content is not supported.");

            case XPathNodeType.Attribute:
                return;

            case XPathNodeType.Text:
            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.Whitespace:
            case XPathNodeType.ProcessingInstruction:
            case XPathNodeType.Comment:
                DeleteSelf();
                return;
            }
            if (!HasChildren)
            {
                return;
            }
            XPathNavigator nav = Clone();

            nav.MoveToFirstChild();
            while (!nav.IsSamePosition(this))
            {
                nav.DeleteSelf();
            }
        }
        /// <summary>
        /// Updates the node replacing inheritdoc node with comments found.
        /// </summary>
        /// <param name="inheritDocNodeNavigator">Navigator for inheritdoc node</param>
        /// <param name="contentNodeNavigator">Navigator for content</param>
        private void UpdateNode(XPathNavigator inheritDocNodeNavigator, XPathNavigator contentNodeNavigator)
        {
            // retrieve the selection filter if specified.
            string selectValue = inheritDocNodeNavigator.GetAttribute("select", string.Empty);

            if(!string.IsNullOrEmpty(selectValue))
                sourceExpression = XPathExpression.Compile(selectValue);

            inheritDocNodeNavigator.MoveToParent();

            if(inheritDocNodeNavigator.LocalName != "comments" && inheritDocNodeNavigator.LocalName != "element")
                sourceExpression = XPathExpression.Compile(inheritDocNodeNavigator.LocalName);
            else
                inheritDocNodeNavigator.MoveTo(this.sourceDocument.CreateNavigator().SelectSingleNode(inheritDocExpression));

            XPathNodeIterator sources = (XPathNodeIterator)contentNodeNavigator.CreateNavigator().Evaluate(sourceExpression);
            inheritDocNodeNavigator.DeleteSelf();

            // append the source nodes to the target node
            foreach(XPathNavigator source in sources)
                inheritDocNodeNavigator.AppendChild(source);
        }
 /// <summary>
 /// Deletes the specified node and logs the message.
 /// </summary>
 /// <param name="inheritDocNodeNavigator">navigator for inheritdoc node</param>
 /// <param name="key">Id of the topic specified</param>
 private void DeleteNode(XPathNavigator inheritDocNodeNavigator, string key)
 {
     base.ParentBuildComponent.WriteMessage(MessageLevel.Info, "Comments not found for topic: {0}", key);
     inheritDocNodeNavigator.DeleteSelf();
 }
 /// <summary>
 /// Deletes the specified node and logs the message.
 /// </summary>
 /// <param name="inheritDocNodeNavigator">navigator for inheritdoc node</param>
 /// <param name="key">Id of the topic specified</param>
 public static void DeleteNode(XPathNavigator inheritDocNodeNavigator, string key)
 {
     ConsoleApplication.WriteMessage(LogLevel.Info, string.Format(CultureInfo.InvariantCulture, "Comments are not found for topic:{0}", key));
     inheritDocNodeNavigator.DeleteSelf();
 }
Example #5
0
 public void DeleteNil(XPathNavigator node)
 {
     if (node.MoveToAttribute(
        "nil", NamespaceManager.LookupNamespace("xsi")))
         node.DeleteSelf();
 }
Example #6
0
 public void DeleteNil(XPathNavigator node)
 {
     if (node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))
         node.DeleteSelf();
 }