편집

다음을 통해 공유


CustomXMLNode.ReplaceChildNode Method

Definition

Removes the specified child node (and its subtree) from the main tree, and replaces it with a different node in the same location.

public void ReplaceChildNode (Microsoft.Office.Core.CustomXMLNode OldNode, string Name = "", string NamespaceURI = "", Microsoft.Office.Core.MsoCustomXMLNodeType NodeType = Microsoft.Office.Core.MsoCustomXMLNodeType.msoCustomXMLNodeElement, string NodeValue = "");
abstract member ReplaceChildNode : Microsoft.Office.Core.CustomXMLNode * string * string * Microsoft.Office.Core.MsoCustomXMLNodeType * string -> unit
Public Sub ReplaceChildNode (OldNode As CustomXMLNode, Optional Name As String = "", Optional NamespaceURI As String = "", Optional NodeType As MsoCustomXMLNodeType = Microsoft.Office.Core.MsoCustomXMLNodeType.msoCustomXMLNodeElement, Optional NodeValue As String = "")

Parameters

OldNode
CustomXMLNode

Represents the child node to be replaced.

Name
String

Represents the base name of the element to be added.

NamespaceURI
String

Represents 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
MsoCustomXMLNodeType

Specifies the type of node to add. If the parameter is not specified, it is assumed to be of type msoCustomXMLNodeElement.

NodeValue
String

Used 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.

Applies to