TXMLDocumentGeneratePrefix (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses the GeneratePrefix function and NSPrefixBase property.

Code

void Test_GeneratePrefix() {
	TXMLDocument *document = new TXMLDocument(NULL);
	document->Active = true;

	// If the document element doesn't exist and the
	// GeneratePrefix function is called, then an exception is raised.
	_di_IXMLNode node = document->CreateNode("TestElement");
	document->DocumentElement = node;

	document->NSPrefixBase = "PrefBase";
	String prefix; // DOMString class is not defined in C++.
	prefix = document->GeneratePrefix(node);
	printf("%ls\n", prefix);

	delete document;
}

Uses