diff --git a/README.md b/README.md index 0b0b3c5..d31e027 100644 --- a/README.md +++ b/README.md @@ -1 +1,83 @@ -# xml-builder \ No newline at end of file +# XML Builder + +## ⚙️ Installation +Installation is done using the [`boss install`](https://github.com/HashLoad/boss) command line: +``` sh +boss install viniciussanchez/xml-builder +``` + +## ⚙️ Manual Installation for Delphi +If you choose to install manually, simply add the following folders to your project, in *Project > Options > Resource Compiler > Directories and Conditionals > Include file search path* +``` +../xml-builder/src +``` + +## ⚡️ Quickstart + +```pascal +uses Xml.Builder; + +var + LDeveloperNode, LProjectsNode: IXmlNode; +begin + LProjectsNode := TXmlNode.New('projects') + .AddElement('Horse', 'yes') + .AddElement('Boss', 'yes') + .AddElement('RESTRequest4Delphi', 'yes') + .AddElement('DataSet-Serialize', 'yes') + .AddElement('BCrypt', 'yes'); + + LDeveloperNode := TXmlNode.New('developer') + .AddAttribute('mvp', 'true') + .AddElement('firstName', 'Vinicius') + .AddElement('lastName', 'Sanchez') + .AddElement('age') + .AddNode(LProjectsNode); + + TXmlBuilder.New + .AddNode(LDeveloperNode) + .Xml; +end; + +// Another way to implement: + +begin + TXmlBuilder.New + .AddNode(TXmlNode.New('developer') + .AddAttribute('mvp', 'true') + .AddElement('firstName', 'Vinicius') + .AddElement('lastName', 'Sanchez') + .AddElement('age') + .AddNode(TXmlNode.New('projects') + .AddElement('Horse', 'yes') + .AddElement('Boss', 'yes') + .AddElement('RESTRequest4Delphi', 'yes') + .AddElement('DataSet-Serialize', 'yes') + .AddElement('BCrypt', 'yes'))) + .Xml; +end; +``` +Result: +```xml + + + Vinicius + Sanchez + + + yes + yes + yes + yes + yes + + +``` +You can also save the file to disk: +```pascal +TXmlBuilder.New.SaveToFile('C:\sample.xml'); +``` + +## ⚠️ License + +`XML Builder` is free and open-source software licensed under the [MIT License](https://github.com/viniciussanchez/xml-builder/blob/master/LICENSE).