RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TXMLDocument.GeneratePrefix Method

Generates a unique namespace prefix that can be used for a node in the document.

Pascal
function GeneratePrefix(const Node: IXMLNode): DOMString;
C++
__fastcall DOMString GeneratePrefix(const IXMLNode Node);

Call GeneratePrefix to generate a new namespace prefix that is not already used in the document to represent a namespace URI. GeneratePrefix uses the NSPrefixBase property to generate a unique string to act as a namespace prefix. This unique string consists of NSPrefixBase followed by a number that ensures uniqueness. Thus, for example, if NSPrefixBase is 'NS', automatically-generated namespace prefixes have the form 'NS1', 'NS2', and so on. 

Node is the interface for the node which will use the newly-generated namespace prefix. 

The generated namespace prefixes are only unique within a single document. If two document components have the same value for NSPrefixBase, they will generate the same namespace prefixes. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!