TXMLDocumentGeneratePrefix (Delphi)
Description
The following example uses the GeneratePrefix function and NSPrefixBase property.
Code
procedure Test_GeneratePrefix;
var
LDocument: TXMLDocument;
LNode: IXMLNode;
LPrefix: DOMString;
begin
LDocument := TXMLDocument.Create(nil);
LDocument.Active := True;
{ If the document element doesn't exist and
function GeneratePrefix is called, then an exception is raised. }
LNode := LDocument.CreateNode('TestElement');
LDocument.DocumentElement := LNode;
LDocument.NSPrefixBase := 'PrefBase';
LPrefix := LDocument.GeneratePrefix(LNode);
Writeln(LPrefix);
LDocument.Free;
end;
Uses
- Xml.XMLDoc.TXMLDocument.Active ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.CreateNode ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.NSPrefixBase ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.GeneratePrefix ( fr | de | ja )