Removes the specified child node from the tree.

Note
References to DTDs from custom XML parts are not supported. DTD references in custom XML parts will not resolve, and custom XML parts containing DTD references generate an exception when an attempt is made to save the file's content to a flat XML file.

Syntax

expression.RemoveChild(Child)

expression An expression that returns a CustomXMLNode object.

Parameters

Name Required/Optional Data Type Description
Child Required CustomXMLNode Represents the child node of the context node.

Remarks

If the node specified in theparameter is not a child of the context node or if the action would result in an invalid tree, the removal is not performed and an error message is displayed.

Example
The following example selects a custom part and then a node in that part. The code then removes a child of that node.

Visual Basic for Applications
Dim cxp1 As CustomXMLPart Dim cxn As CustomXMLNode With ActiveDocument ' Return the first part with the given root namespace. Set cxp1 = .CustomXMLParts("urn:invoice:namespace") ' Get node using XPath expression. Set cxn = cxp1.SelectSingleNode("//*[@supplierID = 1]") ' Remove a child node. cxn.RemoveChild(cxn.SelectSingleNode("//discount")) End With 

See also:

Child