RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TXMLNode.SetChildValue Method

Sets the value of a specified child node.

Pascal
procedure SetChildValue(const IndexOrName: OleVariant; const Value: OleVariant);
C++
__fastcall SetChildValue(const OleVariant IndexOrName, const OleVariant Value);

Use the TXMLNode object's IXMLNode interface to call the protected SetChildValue method. SetChildValue sets the value of a specified child node to a specified value. 

IndexOrName identifies the desired child node by either its interface, or by a string that is the local name of the child node. If IndexOrName does not identify a child of this node, SetChildValue raises an exception. 

Value is the value to assign. It's interpretation depends on the type of the child node, as indicated in the following table:

NodeType 
Value 
ntAttribute  
The attribute value  
ntElement  
If the element contains only text, this is that text value. Otherwise, SetChildValue raises an exception.  
ntText  
The text  
ntCData  
The content of the CDATA section.  
ntProcessingInstr  
The content of the processing instruction except for the target.  
ntComment  
The value (text) of the comment.  
If the child node is any other node type, SetChildValue raises an exception.  
 

Note: Attributes are not considered child nodes of a node. To set the values of this node's attributes, use the SetAttribute method instead.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!