CustomXMLNode.ReplaceChildNode Method
Removes the specified child node (and its subtree) from the main tree, and replaces it with a different node in the same location.
Namespace: Microsoft.Office.Core
Assembly: office (in office.dll)
Syntax
'Declaration
Sub ReplaceChildNode ( _
OldNode As CustomXMLNode, _
Name As String, _
NamespaceURI As String, _
NodeType As MsoCustomXMLNodeType, _
NodeValue As String _
)
'Usage
Dim instance As CustomXMLNode
Dim OldNode As CustomXMLNode
Dim Name As String
Dim NamespaceURI As String
Dim NodeType As MsoCustomXMLNodeType
Dim NodeValue As String
instance.ReplaceChildNode(OldNode, Name, _
NamespaceURI, NodeType, NodeValue)
void ReplaceChildNode(
CustomXMLNode OldNode,
string Name,
string NamespaceURI,
MsoCustomXMLNodeType NodeType,
string NodeValue
)
Parameters
OldNode
Type: Microsoft.Office.Core.CustomXMLNodeRepresents the child node to be replaced.
Name
Type: System.StringRepresents the base name of the element to be added.
NamespaceURI
Type: System.StringRepresents the namespace of the element to be added. This parameter is required if adding nodes of type msoCustomXMLNodeElement or msoCustomXMLNodeAttribute, otherwise it is ignored.
NodeType
Type: Microsoft.Office.Core.MsoCustomXMLNodeTypeSpecifies the type of node to add. If the parameter is not specified, it is assumed to be of type msoCustomXMLNodeElement.
NodeValue
Type: System.StringUsed to set the value of the node to be added for those nodes that allow text. If the node doesn’t allow text, the parameter is ignored.
Remarks
If the OldNode parameter is not a child of the context node or if the operation would result in an invalid tree structure, the replacement is not performed and an error message is displayed. In addition, in a case where the node to be added already exists, the replacement is not performed and an error message is displayed.