TXMLDocumentNodeIndentStr (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses the NodeIndentStr property.

Code

void Test_NodeIndentStr() {
	const String identation = "      ";
	_di_IXMLDocument document;
	_di_IXMLNode node;

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

	document->NodeIndentStr = identation;
	document->Options = document->Options +
		(TXMLDocOptions() << doNodeAutoIndent);
	// Uncomment the following line to see the formatting difference.
	// document->Options = document->Options - (TXMLDocOptions() << doNodeAutoIndent);

	// Create some nodes.
	document->DocumentElement = document->CreateNode("GMC", ntElement);
	node = document->DocumentElement->AddChild("SUV");
	node->Text = "Typhoon";

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

Uses