[fpc-pascal] DOM and namespaces with prefix

Torsten Bonde Christiansen tc at epidata.info
Mon Jun 25 08:24:04 CEST 2012


On 2012-06-23 01:01, Daniel Gaspary wrote:
> On Tue, Jun 19, 2012 at 10:11 AM, Torsten Bonde Christiansen
> <tc at epidata.info> wrote:
>>   DDIInstance := XMLDoc.CreateElementNS('ddi:instance:3_0', 'DDIInstance');
>>   DDIInstance.Prefix := 'ns1';        // this gives me: <ns1:DDIInstance
>> xmlns:ns1="ddi:instance:3_0"> which is great.
>>
>>   // now I would like to expand with eg: xmlns:a="ddi:archive:3_0"
>>   Attr := XMLDoc.CreateAttributeNS('ddi:archive:3_0', 'huh');
>>   Attr.Prefix := 'a';
>>   DDIInstance.SetAttributeNode(Attr);   // but this gives: <ns1:DDIInstance
>> xmlns:ns1="ddi:instance:3_0" xmlns:a="ddi:archive:3_0" a:huh=""/>
>> How can i get the "xmlns:a="ddi:archive:3_0" without the additional
>> attribute AND maintain the namespace + prefix in later elements?
> I believe that the solution(given by Sergei Gorelkin at [1]) is:
>
> DDIInstance.SetAttributeNS('ddi:archive:3_0','xmlns:a','ddi:archive:3_0');
>
> [1] http://bugs.freepascal.org/view.php?id=22299#c60652
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Great - thank you very much!

-Torsten.




More information about the fpc-pascal mailing list