Hallo,
folgendes möchte ich tun: Wenn die Node "thema" mit dem Atrribut "xyz" vorhanden ist, dann füge dort den neuen Eintrag ein. (Wenn der Eintrag noch nicht vorhanden ist: neu, ansonsten updaten) , wenn nicht, erstelle neue Node "thema" mit dem Atrribut "xyz"...
Das hab ich versucht:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43:
| if xmlDoc.documentElement.selectSingleNode('/bilderdatenbank/thema[Attribut="' + athema + '"]') = True then begin for index := 0 to ListBox1.Items.Count -1 do begin newBild := xmlDoc.createElement('Bild');
newSub := xmlDoc.createElement('name'); newSub.text := ListBox1.Items.Strings[Index]; newBild.appendChild(newSub);
newSub := xmlDoc.createElement('text'); newSub.text := atext; newBild.appendChild(newSub);
newThema.appendChild(newBild); end; end else newThema := xmlDoc.createElement('Thema'); newAttr := xmlDoc.createAttribute('name'); newAttr.Text := athema; newThema.attributes.setNamedItem(newAttr); xmlDoc.documentElement.appendChild(newThema); for index := 0 to ListBox1.Items.Count -1 do begin newBild := xmlDoc.createElement('Bild');
newSub := xmlDoc.createElement('name'); newSub.text := ListBox1.Items.Strings[Index]; newBild.appendChild(newSub);
newSub := xmlDoc.createElement('text'); newSub.text := atext; newBild.appendChild(newSub);
newThema.appendChild(newBild); end; xmlDoc.documentElement.appendChild(newThema); xmlDoc.save(fAppPath + DATABASE_FNAME);
end; end; |
wär echt nett, wenn mir da jemand helfen könnte...
gruß
billi
Moderiert von
Tino: Code- durch Delphi-Tags ersetzt.