Chciał bym za pomocą Delphi stworzyć dokument xml. Na razie próbuję stworzyć główny
root dokumentu xml. Niby dałem na końcu sejfowanie dokumentu ale nic nie zapisuje. Może ktoś się tym bawił i mi pomoże. Pozdrawiam!
procedure TForm1.Button1Click(Sender: TObject);
var
root :IXMLDOMElement;
child : IXMLDomElement;
begin
Domdocument1.loadXML('c : / i.xml');
root := Domdocument1.createElement('h1');
Domdocument1.createDocumentFragment.appendChild(root);
Domdocument1.save('c: /i.xml');
end;
Tak w ogóle chcę zrobić tak jak jest w tym przykładzie z tą różnicą że ten przykład jest w javie.
<?xml version="1.0" encoding="iso-8859-2"?> <!DOCTYPE html PUBLIC "-*W3C*DTD XHTML 1.1*EN" "http:*www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <meta http-equiv="reply-to" content="Adres_e-mail" /> <meta name="generator" content="WebSite PRO 4.2" /> <meta name="author" content="Autor_dokumentu" /> <meta name="description" content="Opis" /> <title>Bez Tytułu</title> <script type="text/javascript"> function dodaj(id1,id2){ wartosc1=document.getElementById(id1).value; wartosc2=document.getElementById(id2).value; nowy=document.createElement(wartosc1); nowazawartosc=document.createTextNode(wartosc2); nowy.appendChild(nowazawartosc); document.getElementById('blok').appendChild(nowy); } function rob1(){ lista=document.getElementById('blok').getElementsByTagName('h2'); for(i=0;i<lista.length;i++){ el="lista[i];" -="-" "+i));=""+i));" }="}" </script="</script" el.appendchild(document.createtextnode("="el.appendChild(document.createTextNode("" el.setattribute('style','color:red;');="el.setAttribute('style','color:red;');"> </head> <body>zawartosc<input type="text" id="zawartosc" />
<button onclick="dodaj('element','zawartosc');">Dodaj</button> <button onclick="rob1()">test</button>