Forum: XML
Delphi
by himitsu,
24. Sep 2009
da hatte ich einfach nur etwas zuviel gelöscht :oops:
while Assigned(NodeAnother) do
begin
NodeNext := NodeAnother.NextSibling;
i := 0;
while (i < NodeBase.childNodes.length)
and (not Assigned(NodeBase.childNodes.firstChild)
or not Assigned(NodeAnother.firstChild)
or (NodeBase.childNodes.firstChild.text
Forum: XML
Delphi
by himitsu,
24. Sep 2009
eventuell so?
while Assigned(NodeAnother) do
begin
NodeNext := NodeAnother.NextSibling;
i := 0;
while (i < NodeBase.childNodes.length)
and (mot Assigned(NodeBase.childNodes.firstChild)
or not Assigned(NodeAnother.firstChild)
or (NodeBase.childNodes.firstChild)
<> NodeAnother.firstChild.text)) do
Forum: XML
Delphi
by himitsu,
24. Sep 2009
menno, der Index war doch richtig -.-°
also eigentlich müßte es doch so funktionieren :gruebel:
while Assigned(NodeAnother) do
begin
NodeNext := NodeAnother.NextSibling;
i := 0;
while (i < NodeBase.childNodes.length)
and (NodeBase.childNodes.firstChild.text
<> NodeAnother.firstChild.text) do
Forum: XML
Delphi
by himitsu,
24. Sep 2009
ups, immer diese Indize beim Copy&Paste :oops:
for i2 := 0 to NodeBase.childNodes.childNodes.length - 1 do
NodeBase.childNodes.removeChild(NodeBase.childNodesi2].firstChild);
oder? :gruebel:
NodeBase.childNodes.firstChild.removeChild(NodeBase.childNodesi2].firstChild);
while Assigned(NodeAnother) do
begin
Forum: XML
Delphi
by himitsu,
23. Sep 2009
also dann das löschen so :)
for i2 := 0 to NodeBase.childNodes.childNodes.length - 1 do
NodeBase.childNodes.removeChild(NodeBase.childNodes.firstChild);
Forum: XML
Delphi
by himitsu,
23. Sep 2009
OK, wenn dem so ist, dann laß mal hierbei
if i >= NodeBase.childNodes.length then
begin
NodeBase.appendChild(NodeAnother);
end else begin
NodeBase.childNodes.childNodes.DeleteAllChilds; <<<<<<<
for i := 0 to NodeAnother.childNodes.length - 1 do
NodeBase.childNodes.appendChild(NodeAnother.childNodes);
end;
den Else-Zweig weg ... ich glaub dann stimmts
Forum: XML
Delphi
by himitsu,
23. Sep 2009
Wie um Himmels Willen, wie löscht man bei diesem Ding die alten Nodes?
Aber im Prinzip geht's, auch wenn man via XPath oder so, bestimmt kürzeren Code hinbekommt
function XMLmergeBasefileWithAnotherFile(const aBaseXMLfile, aAnotherXMLfile, aTargetFile: String): Boolean;
var
XmldocBase, XmldocAnother : DOMDocument;
NodeBase, NodeAnother, NodeNext : IXMLDOMNode;
i, i2 ...
Forum: XML
Delphi
by himitsu,
22. Sep 2009
Jupp, da muß der Aufbau schon bekannt sein.
Also du gehst Another wie bekannt durch, holst dir jeweils den Inhalt des untergeordneten Kenn
und nun mußt du schauen ob in Base ein Knoten mir Kenn={Text} vorhanden ist,
- wenn ja
inhalt dieses Knotens in Another löschen und den Inhalt von Base rüberkopieren
oder knoten ganz löschen und dann das Selbe wie in "nein" machen
- wenn nein
Forum: XML
Delphi
by himitsu,
22. Sep 2009
function XMLmergeBasefileWithAnotherFile(const aBaseXMLfile, aAnotherXMLfile, aTargetFile: String): Boolean;
var
XmldocBase, XmldocAnother : DOMDocument;
NodeBase, NodeAnother, NodeNext : IXMLDOMNode;
begin
Result := False;
XmlDocBase := CoDOMDocument.Create;
if not xmlDocBase.load(aBaseXMLfile) then exit;