[fpc-pascal] XML - How to set and use a Namespace Prefix?
Daniel Gaspary
dgaspary at gmail.com
Sat Oct 29 03:53:15 CEST 2011
I'm trying to create an XML Document with multiple Namespaces.
With the code below[1] a get as result the following XML:
<svg xmlns="http://www.w3.org/2000/svg" />
How can I set a second Namespace, should I use SetAttribute or
SetAttributeNS ? :
root.setattribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
?
Can anybody give me an example when setAttributeNS is useful ?
Is there a way to, after setting a namespace prefix, make all
attributes and elements to be added using it ?
Thanks
[1]
var
Doc: TXMLDocument;
root, node: TDOMElement;
begin
Doc:=TXMLDocument.Create;
root:=Doc.CreateElementNS('http://www.w3.org/2000/svg', 'svg');
Doc.AppendChild(root);
...
end;
More information about the fpc-pascal
mailing list