procedure TCreateXML_Form.InitialiseXML;
//Varialbles pour la création du fichier config.XML
var
Doc: TXMLDocument; // variable to document
Racine, RootNode, Default, Funky, Jazz, LowBand, MidBand, nofilho: TDOMNode; // variable to nodes
begin
try
// Create a document
Doc := TXMLDocument.Create;
// Create a root node
Racine := Doc.CreateElement('TPC100');
Doc.Appendchild(Racine); // save root node
//********************************************************************************************************
//******** Config Low Band ************
//********************************************************************************************************
// Create a parent node
Default := Doc.DocumentElement;
Default := Doc.CreateElement('Default');
Racine.Appendchild(Default); // save parent node
// Create a Child node
LowBand := Doc.DocumentElement;
LowBand := Doc.CreateElement('LowBand');
Default.Appendchild(LowBand);
// Create a Sub Subchild node
LowBand := Doc.CreateElement('Dens'); // create a child node
nofilho := Doc.CreateTextNode('50');
LowBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[0].AppendChild(LowBand); // insert child node in respective parent node
// Create a Sub Subchild node
LowBand := Doc.CreateElement('Gate'); // create a child node
nofilho := Doc.CreateTextNode('1'); // insert a value to node
LowBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[0].AppendChild(LowBand); // insert child node in respective parent node
LowBand := Doc.CreateElement('AGC'); // create a child node
nofilho := Doc.CreateTextNode('32'); // insert a value to node
LowBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[0].AppendChild(LowBand); // insert child node in respective parent node
LowBand := Doc.CreateElement('QPoint'); // create a child node
nofilho := Doc.CreateTextNode('80'); // insert a value to node
LowBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[0].AppendChild(LowBand); // insert child node in respective parent node
// Create a Child node
MidBand := Doc.DocumentElement;
MidBand := Doc.CreateElement('MidBand');
Default.Appendchild(MidBand);
// Create a Sub Subchild node
MidBand := Doc.CreateElement('Dens'); // create a child node
nofilho := Doc.CreateTextNode('50');
MidBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[1].AppendChild(MidBand); // insert child node in respective parent node
// Create a Sub Subchild node
MidBand := Doc.CreateElement('Gate'); // create a child node
nofilho := Doc.CreateTextNode('1'); // insert a value to node
MidBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[1].AppendChild(MidBand); // insert child node in respective parent node
MidBand := Doc.CreateElement('AGC'); // create a child node
nofilho := Doc.CreateTextNode('32'); // insert a value to node
MidBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[1].AppendChild(MidBand); // insert child node in respective parent node
MidBand := Doc.CreateElement('QPoint'); // create a child node
nofilho := Doc.CreateTextNode('80'); // insert a value to node
MidBand.Appendchild(nofilho); // save node
Default.ChildNodes.Item[1].AppendChild(MidBand); // insert child node in respective parent node
writeXMLFile(Doc, 'config.xml'); // write to XML
finally
Doc.Free; // free memory
end;
end;