TXMLDocumentCreateElement (C++)

From RAD Studio Code Examples
Jump to: navigation, search


The following example sets the document element by adding a child element to the document.


void Test_AddChild() {
	_di_IXMLDocument document;
	_di_IXMLNode node;

	document = interface_cast<Xmlintf::IXMLDocument>(new TXMLDocument(NULL));
	document->Active = true;

	// Add new child. This will become the document element.
	// If the document element already exists, then an exception is raised.
	node = document->AddChild("Airbus");

	// Display document content.
	printf("%ls\n", document->XML->Text);