Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   XML (https://www.delphipraxis.net/46-xml/)
-   -   Prism XML-Attribute kopieren - mit Prefix ? (https://www.delphipraxis.net/87423-xml-attribute-kopieren-mit-prefix.html)

alzaimar 28. Feb 2007 15:18


XML-Attribute kopieren - mit Prefix ?
 
Hallo!
Ich habe zwei Knoten 'NewValue' und 'Value'. Value hat ein Attribut 'xsi:type="xxxx"' und dieses Attribut soll in den 'NewValue' Knoten rein. Fein.

Also schreibe ich
Delphi-Quellcode:
Procedure _CopyAttributes(aSrc, aDst: IXMLNode);
Begin
  aDst.Attributes['xsi:type'] := aSrc.Attributes['xsi:type'];
End;
und erhalte
XML-Code:
<A1W>
<Value xsi:type="xsd:float">95.88</Value>
<NewValue type="xsd:float">95.8800</NewValue>
</A1W>
:shock: (Hinter dem NewValue fehlt das 'xsi'). Auch irgendwie klar. Leider ist 'Prefix' read-only, sodaß ich nicht einfach den Prefix mit kopieren kann.

Wie schaffe ich es, das das Attribut des 'NewValue' genauso heißt, wie vom 'Value'?

Danke für Hinweise.

marabu 28. Feb 2007 20:48

Re: XML-Attribute kopieren - mit Prefix ?
 
Hallo alzaimar,

du musst in deinem Beispiel den NameSpace xmlns:xsi deklarieren - dann funktioniert es so wie du denkst.

Gute Nacht


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz