Xml.XMLIntf.IXMLDocument.CreateNode

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CreateNode(const NameOrData: DOMString;
NodeType: TNodeType = ntElement; const AddlData: DOMString = ''): IXMLNode;

C++

virtual _di_IXMLNode __fastcall CreateNode(const System::UnicodeString NameOrData, TNodeType NodeType = (TNodeType)(0x1), const System::UnicodeString AddlData = System::UnicodeString()) = 0 ;

Properties

Type Visibility Source Unit Parent
function public
Xml.XMLIntf.pas
Xml.XMLIntf.hpp
Xml.XMLIntf IXMLDocument

Description

Creates a new node that is associated with this document.

Call CreateNode to create a new generic XML node. The resulting node does not have a parent, but can be added to the ChildNodes or AttributeNodes list of any node in the document (including this document's ChildNodes property).

NameOrData provides the tag name or value of the newly created node. Its interpretation depends on the type of node created, as indicated in the following table:



NodeType NameOrData

ntElement

The tag name.

ntAttribute

The attribute name.

ntText

The value of the node.

ntCData

The value of the CDATA section.

ntEntityRef

The name of the referenced entity.

ntProcessingInstr

The target of the processing instruction.

ntComment

The value (text) of the comment.

ntDocFragment

Not used.

ntElement

The namespace URI that qualifies the tag name.

ntAttribute

The namespace URI that qualifies the attribute name.

ntProcessingInstr

The content of the processing instruction, except for the target.



NodeType indicates the type of node to create. It can only be one of the types listed in the previous table.

The meaning of AddlData depends on the node type, as indicated in the following table:



NodeType AddlData

ntElement

The namespace URI that qualifies the tag name.

ntAttribute

The namespace URI that qualifies the attribute name.

ntProcessingInstr

The content of the processing instruction, except for the target.



CreateNode returns the interface for the new node.

Note: To add a node as the child of another node in this document, it is simpler to call that node's AddChild method.

See Also