Beyaz.Net İpucu
Create XML
XML oluşturma fonksiyonu
var
iXml: IDOMDocument;
iRoot, iNode, iNode2, iChild, i2Child, iAttribute: IDOMNode;
begin
// empty the document
XMLDoc.Active := False;
XMLDoc.XML.Text := '';
XMLDoc.Active := True;
// root
iXml := XmlDoc.DOMDocument;
iRoot := iXml.appendChild (iXml.createElement ('xml'));
// node "test"
iNode := iRoot.appendChild (iXml.createElement ('settings'));
iChild := iNode.appendChild (iXml.createElement ('combos'));
i2Child := iChild.appendChild (iXml.createElement('combo'));
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'hasan';
i2Child.attributes.setNamedItem (iAttribute);
i2Child.appendChild(iXml.createTextNode('zibil gibin bilgi'));
///
i2Child := iChild.appendChild (iXml.createElement('combo'));
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'veli';
i2Child.attributes.setNamedItem (iAttribute);
i2Child.appendChild(iXml.createTextNode(memo2.Text));
// iAttribute := iXml.createAttribute ('value');
// iAttribute.nodeValue := 'zibil';
// i2Child.attributes.setNamedItem (iAttribute);
// // node replication
// iNode2 := iNode.cloneNode (True);
// iRoot.appendChild (iNode2);
//
// // add an attribute
// iAttribute := iXml.createAttribute ('color');
// iAttribute.nodeValue := 'red';
// iNode2.attributes.setNamedItem (iAttribute);
//
// // show XML in memo
Memo1.Lines.Text := FormatXMLData (XMLDoc.XML.Text);