├── .gitignore ├── LICENSE ├── README.md ├── boss-lock.json ├── boss.json ├── samples ├── delphi │ ├── Views.Samples.dfm │ ├── Views.Samples.pas │ ├── samples.dpr │ ├── samples.dproj │ └── teste.xml └── lazarus │ ├── Samples.lpi │ ├── Samples.lpr │ ├── teste.xml │ ├── views.samples.lfm │ └── views.samples.pas └── src ├── Xml.Reader.Attribute.Intf.pas ├── Xml.Reader.Attribute.pas ├── Xml.Reader.Element.Intf.pas ├── Xml.Reader.Element.pas ├── Xml.Reader.Intf.pas ├── Xml.Reader.Node.Intf.pas ├── Xml.Reader.Node.pas └── Xml.Reader.pas /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | *.res 7 | 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | 28 | # Delphi compiler-generated binaries (safe to delete) 29 | *.exe 30 | *.dll 31 | *.bpl 32 | *.bpi 33 | *.dcp 34 | *.so 35 | *.apk 36 | *.drc 37 | *.map 38 | *.dres 39 | *.rsm 40 | *.tds 41 | *.dcu 42 | *.lib 43 | *.a 44 | *.o 45 | *.ocx 46 | 47 | # Delphi autogenerated files (duplicated info) 48 | *.cfg 49 | *.hpp 50 | *Resource.rc 51 | 52 | # Delphi local files (user-specific info) 53 | *.local 54 | *.identcache 55 | *.projdata 56 | *.tvsconfig 57 | *.skincfg 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | 71 | # Lazarus 72 | *.ico 73 | *.lps 74 | lib/ 75 | backup/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Vinicius Sanchez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XML Reader 2 | 3 | ## ⚙️ Installation 4 | Installation is done using the [`boss install`](https://github.com/HashLoad/boss) command line: 5 | ``` sh 6 | boss install viniciussanchez/xml-reader 7 | ``` 8 | 9 | ## ⚙️ Manual Installation for Delphi 10 | 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* 11 | ``` 12 | ../xml-reader/src 13 | ``` 14 | 15 | ## ⚡️ Quickstart 16 | 17 | ```pascal 18 | uses Xml.Reader; 19 | ``` 20 | 21 | #### Load from file 22 | 23 | ```pascal 24 | var 25 | LXmlReader: IXmlReader; 26 | begin 27 | LXmlReader := TXmlReader.New.LoadFromFile('C:\xml\nfe.xml'); 28 | end; 29 | ``` 30 | 31 | #### Load from string 32 | 33 | ```pascal 34 | var 35 | LXmlReader: IXmlReader; 36 | begin 37 | LXmlReader := TXmlReader.New.LoadFromString('my xml here!'); 38 | end; 39 | ``` 40 | 41 | #### Get xml version 42 | 43 | ```pascal 44 | begin 45 | Result := LXmlReader.Version; 46 | end; 47 | ``` 48 | 49 | #### Get xml encoding 50 | 51 | ```pascal 52 | begin 53 | Result := LXmlReader.Encoding; 54 | end; 55 | ``` 56 | 57 | #### Get main node 58 | 59 | ```pascal 60 | var 61 | LMainNode: IXmlNode; 62 | begin 63 | LMainNode := LXmlReader.Node; 64 | end; 65 | ``` 66 | 67 | #### How to list nodes 68 | 69 | ```pascal 70 | var 71 | LNode: IXmlNode; 72 | begin 73 | for LNode in LMainNode.Nodes do 74 | // my code here! 75 | end; 76 | ``` 77 | 78 | #### How to list attributes 79 | 80 | ```pascal 81 | var 82 | LAttribute: IXmlAttribute; 83 | begin 84 | for LAttribute in LMainNode.Attributes do 85 | // my code here! 86 | end; 87 | ``` 88 | 89 | #### How to list elements 90 | 91 | ```pascal 92 | var 93 | LElement: IXmlElement; 94 | begin 95 | for LElement in LMainNode.Elements do 96 | // my code here! 97 | end; 98 | ``` 99 | 100 | #### Other resources 101 | 102 | ```pascal 103 | var 104 | LNode: IXmlNode; 105 | LElement: IXmlElement; 106 | LAttribute: IXmlAttribute; 107 | begin 108 | // get the name of a node 109 | LNode.Name; 110 | 111 | // check if the node has an attribute 112 | LNode.ContainsAttribute('attribute name'); 113 | 114 | // check if the node has a node 115 | LNode.ContainsNode('node name'); 116 | 117 | // check if the node has an element 118 | LNode.ContainsElement('element name'); 119 | 120 | // get the value of an attribute from a node 121 | LNode.GetAttribute('attribute name'); 122 | 123 | // get a node from a node 124 | LNode.GetNode('node name'); 125 | 126 | // get the element of a node 127 | LNode.GetElement('element name'); 128 | 129 | // get the attributes of a node 130 | LNode.Attributes; 131 | 132 | // get the elements of a node 133 | LNode.Elements; 134 | 135 | // get the nodes of a node 136 | LNode.Nodes; 137 | 138 | // get the name of an element 139 | LElement.Name; 140 | 141 | // get the value of an element 142 | LElement.Value; 143 | 144 | // get the value in string format from an element 145 | LElement.AsString; 146 | 147 | // get the value in integer format of an element 148 | LElement.AsInteger; 149 | 150 | // get the name of an attribute 151 | LAttribute.Name; 152 | 153 | // get the value of an attribute 154 | LAttribute.Value; 155 | 156 | // get the value in string format of an attribute 157 | LAttribute.AsString; 158 | 159 | // get the value in integer format of an attribute 160 | LAttribute.AsInteger; 161 | end; 162 | ``` 163 | 164 | ## ⚠️ License 165 | 166 | `XML Reader` is free and open-source software licensed under the [MIT License](https://github.com/viniciussanchez/xml-reader/blob/master/LICENSE). 167 | -------------------------------------------------------------------------------- /boss-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "hash": "d41d8cd98f00b204e9800998ecf8427e", 3 | "updated": "2022-06-02T11:16:33.4487686-03:00", 4 | "installedModules": {} 5 | } -------------------------------------------------------------------------------- /boss.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xml-reader", 3 | "description": "", 4 | "version": "1.0.0", 5 | "homepage": "", 6 | "mainsrc": "./", 7 | "projects": [], 8 | "dependencies": {} 9 | } -------------------------------------------------------------------------------- /samples/delphi/Views.Samples.dfm: -------------------------------------------------------------------------------- 1 | object FrmSamples: TFrmSamples 2 | Left = 0 3 | Top = 0 4 | Caption = 'Samples' 5 | ClientHeight = 299 6 | ClientWidth = 635 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | PixelsPerInch = 96 15 | TextHeight = 13 16 | object mmXML: TMemo 17 | Left = 24 18 | Top = 56 19 | Width = 585 20 | Height = 225 21 | TabOrder = 0 22 | end 23 | object btnReadString: TButton 24 | Left = 24 25 | Top = 15 26 | Width = 75 27 | Height = 25 28 | Caption = 'Read string' 29 | TabOrder = 1 30 | OnClick = btnReadStringClick 31 | end 32 | object btnReadFile: TButton 33 | Left = 105 34 | Top = 15 35 | Width = 75 36 | Height = 25 37 | Caption = 'Read file' 38 | TabOrder = 2 39 | OnClick = btnReadFileClick 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /samples/delphi/Views.Samples.pas: -------------------------------------------------------------------------------- 1 | unit Views.Samples; 2 | 3 | interface 4 | 5 | uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 6 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Xml.Reader, Vcl.StdCtrls; 7 | 8 | type 9 | TFrmSamples = class(TForm) 10 | mmXML: TMemo; 11 | btnReadString: TButton; 12 | btnReadFile: TButton; 13 | procedure btnReadStringClick(Sender: TObject); 14 | procedure btnReadFileClick(Sender: TObject); 15 | private 16 | procedure DoPrintElement(const AElement: IXmlElement); 17 | procedure DoPrintAttribute(const AAttribute: IXmlAttribute); 18 | procedure DoPrintNode(const ANode: IXmlNode); 19 | procedure Read(const AXml: IXmlReader); 20 | end; 21 | 22 | var 23 | FrmSamples: TFrmSamples; 24 | 25 | implementation 26 | 27 | {$R *.dfm} 28 | 29 | const 30 | XML = 'Vinicius' + 31 | 'Sanchezyesyes' + 32 | 'yesyesyes'; 33 | 34 | procedure TFrmSamples.btnReadFileClick(Sender: TObject); 35 | begin 36 | Read(TXmlReader.New.LoadFromFile('..\..\teste.xml')); 37 | end; 38 | 39 | procedure TFrmSamples.btnReadStringClick(Sender: TObject); 40 | begin 41 | Read(TXmlReader.New.LoadFromString(XML)); 42 | end; 43 | 44 | procedure TFrmSamples.DoPrintAttribute(const AAttribute: IXmlAttribute); 45 | begin 46 | mmXML.Lines.Add('[Attribute] Name: ' + AAttribute.Name + ' value: ' + AAttribute.AsString); 47 | end; 48 | 49 | procedure TFrmSamples.DoPrintElement(const AElement: IXmlElement); 50 | begin 51 | mmXML.Lines.Add('[Element] Name: ' + AElement.Name + ' value: ' + AElement.AsString); 52 | end; 53 | 54 | procedure TFrmSamples.DoPrintNode(const ANode: IXmlNode); 55 | var 56 | LElement: IXmlElement; 57 | LAttribute: IXmlAttribute; 58 | LNode: IXmlNode; 59 | begin 60 | mmXML.Lines.Add('[Node] Name: ' + ANode.Name); 61 | 62 | for LAttribute in ANode.Attributes do 63 | DoPrintAttribute(LAttribute); 64 | 65 | for LElement in ANode.Elements do 66 | DoPrintElement(LElement); 67 | 68 | for LNode in ANode.Nodes do 69 | DoPrintNode(LNode); 70 | end; 71 | 72 | procedure TFrmSamples.Read(const AXml: IXmlReader); 73 | begin 74 | mmXML.Lines.Add('Version: ' + AXml.Version); 75 | mmXML.Lines.Add('Encoding: ' + AXml.Encoding); 76 | DoPrintNode(AXml.Node); 77 | end; 78 | 79 | end. 80 | -------------------------------------------------------------------------------- /samples/delphi/samples.dpr: -------------------------------------------------------------------------------- 1 | program samples; 2 | 3 | uses 4 | Vcl.Forms, 5 | Views.Samples in 'Views.Samples.pas' {FrmSamples}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | ReportMemoryLeaksOnShutdown := True; 11 | Application.Initialize; 12 | Application.MainFormOnTaskbar := True; 13 | Application.CreateForm(TFrmSamples, FrmSamples); 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /samples/delphi/samples.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {95D96F30-28E9-4153-B29E-17D1815C3DFA} 4 | 18.8 5 | VCL 6 | samples.dpr 7 | True 8 | Debug 9 | Win32 10 | 1 11 | Application 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Base 40 | true 41 | 42 | 43 | true 44 | Cfg_2 45 | true 46 | true 47 | 48 | 49 | .\$(Platform)\$(Config) 50 | .\$(Platform)\$(Config) 51 | false 52 | false 53 | false 54 | false 55 | false 56 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 57 | $(BDS)\bin\delphi_PROJECTICON.ico 58 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png 59 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png 60 | samples 61 | 62 | 63 | DBXSqliteDriver;dxFlowChartRS26;dxPSdxMapControlLnkRS26;DBXDb2Driver;vclactnband;dxBarRS26;vclFireDAC;dxFireDACEMFRS26;tethering;dxSpreadSheetInplaceRichEditRS26;FireDACADSDriver;dxSkinVisualStudio2013BlueRS26;dxRichEditCoreRS26;dxPSdxSpreadSheetLnkRS26;dxSkinSharpPlusRS26;FireDACMSSQLDriver;vcltouch;vcldb;svn;dxPSTeeChartRS26;dxSkinFoggyRS26;dxSkinVisualStudio2013DarkRS26;dxSkinOffice2013DarkGrayRS26;dxGDIPlusRS26;dxAuthorizationAgentsRS26;dxPSdxFCLnkRS26;vclib;frxTee26;dxPSLnksRS26;FireDACDBXDriver;cxGridRS26;dxPsPrVwAdvRS26;dxPDFViewerRS26;dxSkinSpringTimeRS26;boss_ide;vclx;dxPScxTLLnkRS26;dxSkinOffice2010BlueRS26;RESTBackendComponents;dxSkinOffice2016DarkRS26;VCLRESTComponents;dxSkinMoneyTwinsRS26;dxSkinOffice2016ColorfulRS26;fsTee26;dxSkinValentineRS26;dxSkinHighContrastRS26;vclie;bindengine;CloudService;dxmdsRS26;FireDACMySQLDriver;fsIBX26;frx26;dxdborRS26;DataSnapClient;dxSkinOffice2013WhiteRS26;dxFireDACServerModeRS26;bindcompdbx;fsFD26;DBXSybaseASEDriver;IndyIPServer;cxPivotGridRS26;IndySystem;fsADO26;frxDBX26;dxSkinDarkRoomRS26;cxTreeListdxBarPopupMenuRS26;dsnapcon;cxTreeListRS26;dxPScxPivotGridLnkRS26;cxSchedulerRibbonStyleEventEditorRS26;dxPSCoreRS26;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSpreadSheetRS26;dxBarExtItemsRS26;dxPSdxGaugeControlLnkRS26;emshosting;dxSkinLondonLiquidSkyRS26;DBXOdbcDriver;FireDACTDataDriver;FMXTee;dxdbtrRS26;dxRichEditControlCoreRS26;soaprtl;DbxCommonDriver;dxFlowChartAdvancedCustomizeFormRS26;dxSkinLiquidSkyRS26;dxSkinSevenRS26;dxDockingRS26;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;cxLibraryRS26;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;cxDataRS26;dxPScxSchedulerLnkRS26;dxSpreadSheetConditionalFormattingDialogsRS26;appanalytics;dxRibbonCustomizationFormRS26;cxSchedulerGridRS26;IndyIPClient;bindcompvcl;dxSkinVisualStudio2013LightRS26;TeeUI;dxADOEMFRS26;VclSmp;FireDACODBCDriver;dxRibbonRS26;DataSnapIndy10ServerTransport;dxPScxCommonRS26;dxRichEditDocumentModelRS26;DataSnapProviderClient;FireDACMongoDBDriver;dxPScxGridLnkRS26;dxSkinDevExpressDarkStyleRS26;dxSpreadSheetCoreRS26;RESTComponents;dxSkinGlassOceansRS26;DBXInterBaseDriver;dxPScxExtCommonRS26;dxSkinPumpkinRS26;emsclientfiredac;dxSkinXmas2008BlueRS26;DataSnapFireDAC;svnui;frxFD26;dxSkinOffice2007SilverRS26;cxPageControlRS26;dxSkinTheBezierRS26;dxSkinDevExpressStyleRS26;DBXMSSQLDriver;dxRichEditControlRS26;DatasnapConnectorsFreePascal;dxGaugeControlRS26;dxorgcRS26;dxPScxVGridLnkRS26;bindcompfmx;dxSkinOffice2007PinkRS26;DBXOracleDriver;inetdb;dxSkinOffice2007BlueRS26;dxSkinStardustRS26;CEF4Delphi;dxBarDBNavRS26;dxDBXServerModeRS26;dxSkinTheAsphaltWorldRS26;dxSkinSilverRS26;FmxTeeUI;emsedge;dxLayoutControlRS26;fmx;FireDACIBDriver;fmxdae;dxServerModeRS26;dxWizardControlRS26;dxSkinBlueprintRS26;dxSkiniMaginaryRS26;dxTabbedMDIRS26;fs26;dxEMFRS26;dbexpress;IndyCore;dxComnRS26;frxIntIO26;dsnap;emsclient;DataSnapCommon;dxSkinSharpRS26;FireDACCommon;DataSnapConnectors;cxSchedulerTreeBrowserRS26;dxADOServerModeRS26;soapserver;dxSkinOffice2007BlackRS26;cxVerticalGridRS26;dxtrmdRS26;FireDACOracleDriver;DBXMySQLDriver;cxEditorsRS26;cxSchedulerRS26;cxSchedulerWebServiceStorageRS26;DBXFirebirdDriver;dxSkinMetropolisDarkRS26;dxSkinOffice2010BlackRS26;dxPSdxLCLnkRS26;FireDACCommonODBC;FireDACCommonDriver;dxMapControlRS26;dxSkinBlackRS26;dxSkinOffice2013LightGrayRS26;frxIntIOIndy26;inet;dxSpellCheckerRS26;dxSkinCoffeeRS26;IndyIPCommon;dxSpreadSheetCoreConditionalFormattingDialogsRS26;vcl;dxPSdxDBOCLnkRS26;frxDB26;dxSkinMetropolisRS26;FireDACDb2Driver;dxSpreadSheetReportDesignerRS26;dxPScxPCProdRS26;dxNavBarRS26;fsDB26;dxCoreRS26;cxExportRS26;TeeDB;FireDAC;dxThemeRS26;dxHttpIndyRequestRS26;dxPSPrVwRibbonRS26;dxSkinOffice2010SilverRS26;frxe26;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinSevenClassicRS26;cxPivotGridChartRS26;dxPSRichEditControlLnkRS26;frxIBX26;dxPSDBTeeChartRS26;ibxpress;Tee;DataSnapServer;ibxbindings;dxPSdxDBTVLnkRS26;vclwinx;FireDACDSDriver;frxADO26;dxOfficeCoreRS26;dxTileControlRS26;dxSkinsCoreRS26;CustomIPTransport;vcldsnap;DOSCommandDR;bindcomp;dxSkinLilianRS26;dxSkinSummer2008RS26;DBXInformixDriver;dxPSdxOCLnkRS26;dxSkinVS2010RS26;dxSkinBlueRS26;dmvcframeworkRT;dbxcds;adortl;dxSkinMcSkinRS26;dxSkinDarkSideRS26;dmvcframeworkDT;dxSpreadSheetCoreDialogsRS26;dxBarExtDBItemsRS26;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxSkinOffice2007GreenRS26;dxRichEditInplaceRS26;dxSkinWhiteprintRS26;dxPSdxPDFViewerLnkRS26;dxSkinCaramelRS26;fmxase;$(DCC_UsePackage) 64 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 65 | Debug 66 | true 67 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 68 | 1033 69 | $(BDS)\bin\default_app.manifest 70 | 71 | 72 | DBXSqliteDriver;dxFlowChartRS26;dxPSdxMapControlLnkRS26;DBXDb2Driver;vclactnband;dxBarRS26;vclFireDAC;dxFireDACEMFRS26;tethering;dxSpreadSheetInplaceRichEditRS26;FireDACADSDriver;dxSkinVisualStudio2013BlueRS26;dxRichEditCoreRS26;dxPSdxSpreadSheetLnkRS26;dxSkinSharpPlusRS26;FireDACMSSQLDriver;vcltouch;vcldb;dxPSTeeChartRS26;dxSkinFoggyRS26;dxSkinVisualStudio2013DarkRS26;dxSkinOffice2013DarkGrayRS26;dxGDIPlusRS26;dxAuthorizationAgentsRS26;dxPSdxFCLnkRS26;vclib;dxPSLnksRS26;FireDACDBXDriver;cxGridRS26;dxPsPrVwAdvRS26;dxPDFViewerRS26;dxSkinSpringTimeRS26;vclx;dxPScxTLLnkRS26;dxSkinOffice2010BlueRS26;RESTBackendComponents;dxSkinOffice2016DarkRS26;VCLRESTComponents;dxSkinMoneyTwinsRS26;dxSkinOffice2016ColorfulRS26;dxSkinValentineRS26;dxSkinHighContrastRS26;vclie;bindengine;CloudService;dxmdsRS26;FireDACMySQLDriver;dxdborRS26;DataSnapClient;dxSkinOffice2013WhiteRS26;dxFireDACServerModeRS26;bindcompdbx;DBXSybaseASEDriver;IndyIPServer;cxPivotGridRS26;IndySystem;dxSkinDarkRoomRS26;cxTreeListdxBarPopupMenuRS26;dsnapcon;cxTreeListRS26;dxPScxPivotGridLnkRS26;cxSchedulerRibbonStyleEventEditorRS26;dxPSCoreRS26;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSpreadSheetRS26;dxBarExtItemsRS26;dxPSdxGaugeControlLnkRS26;emshosting;dxSkinLondonLiquidSkyRS26;DBXOdbcDriver;FireDACTDataDriver;FMXTee;dxdbtrRS26;dxRichEditControlCoreRS26;soaprtl;DbxCommonDriver;dxFlowChartAdvancedCustomizeFormRS26;dxSkinLiquidSkyRS26;dxSkinSevenRS26;dxDockingRS26;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;cxLibraryRS26;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;cxDataRS26;dxPScxSchedulerLnkRS26;dxSpreadSheetConditionalFormattingDialogsRS26;appanalytics;dxRibbonCustomizationFormRS26;cxSchedulerGridRS26;IndyIPClient;bindcompvcl;dxSkinVisualStudio2013LightRS26;TeeUI;dxADOEMFRS26;VclSmp;FireDACODBCDriver;dxRibbonRS26;DataSnapIndy10ServerTransport;dxPScxCommonRS26;dxRichEditDocumentModelRS26;DataSnapProviderClient;FireDACMongoDBDriver;dxPScxGridLnkRS26;dxSkinDevExpressDarkStyleRS26;dxSpreadSheetCoreRS26;RESTComponents;dxSkinGlassOceansRS26;DBXInterBaseDriver;dxPScxExtCommonRS26;dxSkinPumpkinRS26;emsclientfiredac;dxSkinXmas2008BlueRS26;DataSnapFireDAC;dxSkinOffice2007SilverRS26;cxPageControlRS26;dxSkinTheBezierRS26;dxSkinDevExpressStyleRS26;DBXMSSQLDriver;dxRichEditControlRS26;DatasnapConnectorsFreePascal;dxGaugeControlRS26;dxorgcRS26;dxPScxVGridLnkRS26;bindcompfmx;dxSkinOffice2007PinkRS26;DBXOracleDriver;inetdb;dxSkinOffice2007BlueRS26;dxSkinStardustRS26;CEF4Delphi;dxBarDBNavRS26;dxDBXServerModeRS26;dxSkinTheAsphaltWorldRS26;dxSkinSilverRS26;FmxTeeUI;emsedge;dxLayoutControlRS26;fmx;FireDACIBDriver;fmxdae;dxServerModeRS26;dxWizardControlRS26;dxSkinBlueprintRS26;dxSkiniMaginaryRS26;dxTabbedMDIRS26;dxEMFRS26;dbexpress;IndyCore;dxComnRS26;dsnap;emsclient;DataSnapCommon;dxSkinSharpRS26;FireDACCommon;DataSnapConnectors;cxSchedulerTreeBrowserRS26;dxADOServerModeRS26;soapserver;dxSkinOffice2007BlackRS26;cxVerticalGridRS26;dxtrmdRS26;FireDACOracleDriver;DBXMySQLDriver;cxEditorsRS26;cxSchedulerRS26;cxSchedulerWebServiceStorageRS26;DBXFirebirdDriver;dxSkinMetropolisDarkRS26;dxSkinOffice2010BlackRS26;dxPSdxLCLnkRS26;FireDACCommonODBC;FireDACCommonDriver;dxMapControlRS26;dxSkinBlackRS26;dxSkinOffice2013LightGrayRS26;inet;dxSpellCheckerRS26;dxSkinCoffeeRS26;IndyIPCommon;dxSpreadSheetCoreConditionalFormattingDialogsRS26;vcl;dxPSdxDBOCLnkRS26;dxSkinMetropolisRS26;FireDACDb2Driver;dxSpreadSheetReportDesignerRS26;dxPScxPCProdRS26;dxNavBarRS26;dxCoreRS26;cxExportRS26;TeeDB;FireDAC;dxThemeRS26;dxHttpIndyRequestRS26;dxPSPrVwRibbonRS26;dxSkinOffice2010SilverRS26;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;dxSkinSevenClassicRS26;cxPivotGridChartRS26;dxPSRichEditControlLnkRS26;dxPSDBTeeChartRS26;ibxpress;Tee;DataSnapServer;ibxbindings;dxPSdxDBTVLnkRS26;vclwinx;FireDACDSDriver;dxOfficeCoreRS26;dxTileControlRS26;dxSkinsCoreRS26;CustomIPTransport;vcldsnap;DOSCommandDR;bindcomp;dxSkinLilianRS26;dxSkinSummer2008RS26;DBXInformixDriver;dxPSdxOCLnkRS26;dxSkinVS2010RS26;dxSkinBlueRS26;dbxcds;adortl;dxSkinMcSkinRS26;dxSkinDarkSideRS26;dxSpreadSheetCoreDialogsRS26;dxBarExtDBItemsRS26;dsnapxml;dbrtl;IndyProtocols;inetdbxpress;dxSkinOffice2007GreenRS26;dxRichEditInplaceRS26;dxSkinWhiteprintRS26;dxPSdxPDFViewerLnkRS26;dxSkinCaramelRS26;fmxase;$(DCC_UsePackage) 73 | 74 | 75 | DEBUG;$(DCC_Define) 76 | true 77 | false 78 | true 79 | true 80 | true 81 | 82 | 83 | false 84 | true 85 | PerMonitorV2 86 | ..\..\src;$(DCC_UnitSearchPath) 87 | true 88 | 1033 89 | 90 | 91 | false 92 | RELEASE;$(DCC_Define) 93 | 0 94 | 0 95 | 96 | 97 | true 98 | PerMonitorV2 99 | 100 | 101 | 102 | MainSource 103 | 104 | 105 |
FrmSamples
106 | dfm 107 |
108 | 109 | Cfg_2 110 | Base 111 | 112 | 113 | Base 114 | 115 | 116 | Cfg_1 117 | Base 118 | 119 |
120 | 121 | Delphi.Personality.12 122 | Application 123 | 124 | 125 | 126 | samples.dpr 127 | 128 | 129 | 130 | 131 | 132 | samples.exe 133 | true 134 | 135 | 136 | 137 | 138 | 1 139 | 140 | 141 | Contents\MacOS 142 | 1 143 | 144 | 145 | 0 146 | 147 | 148 | 149 | 150 | classes 151 | 1 152 | 153 | 154 | classes 155 | 1 156 | 157 | 158 | 159 | 160 | res\xml 161 | 1 162 | 163 | 164 | res\xml 165 | 1 166 | 167 | 168 | 169 | 170 | library\lib\armeabi-v7a 171 | 1 172 | 173 | 174 | 175 | 176 | library\lib\armeabi 177 | 1 178 | 179 | 180 | library\lib\armeabi 181 | 1 182 | 183 | 184 | 185 | 186 | library\lib\armeabi-v7a 187 | 1 188 | 189 | 190 | 191 | 192 | library\lib\mips 193 | 1 194 | 195 | 196 | library\lib\mips 197 | 1 198 | 199 | 200 | 201 | 202 | library\lib\armeabi-v7a 203 | 1 204 | 205 | 206 | library\lib\arm64-v8a 207 | 1 208 | 209 | 210 | 211 | 212 | library\lib\armeabi-v7a 213 | 1 214 | 215 | 216 | 217 | 218 | res\drawable 219 | 1 220 | 221 | 222 | res\drawable 223 | 1 224 | 225 | 226 | 227 | 228 | res\values 229 | 1 230 | 231 | 232 | res\values 233 | 1 234 | 235 | 236 | 237 | 238 | res\values-v21 239 | 1 240 | 241 | 242 | res\values-v21 243 | 1 244 | 245 | 246 | 247 | 248 | res\values 249 | 1 250 | 251 | 252 | res\values 253 | 1 254 | 255 | 256 | 257 | 258 | res\drawable 259 | 1 260 | 261 | 262 | res\drawable 263 | 1 264 | 265 | 266 | 267 | 268 | res\drawable-xxhdpi 269 | 1 270 | 271 | 272 | res\drawable-xxhdpi 273 | 1 274 | 275 | 276 | 277 | 278 | res\drawable-ldpi 279 | 1 280 | 281 | 282 | res\drawable-ldpi 283 | 1 284 | 285 | 286 | 287 | 288 | res\drawable-mdpi 289 | 1 290 | 291 | 292 | res\drawable-mdpi 293 | 1 294 | 295 | 296 | 297 | 298 | res\drawable-hdpi 299 | 1 300 | 301 | 302 | res\drawable-hdpi 303 | 1 304 | 305 | 306 | 307 | 308 | res\drawable-xhdpi 309 | 1 310 | 311 | 312 | res\drawable-xhdpi 313 | 1 314 | 315 | 316 | 317 | 318 | res\drawable-mdpi 319 | 1 320 | 321 | 322 | res\drawable-mdpi 323 | 1 324 | 325 | 326 | 327 | 328 | res\drawable-hdpi 329 | 1 330 | 331 | 332 | res\drawable-hdpi 333 | 1 334 | 335 | 336 | 337 | 338 | res\drawable-xhdpi 339 | 1 340 | 341 | 342 | res\drawable-xhdpi 343 | 1 344 | 345 | 346 | 347 | 348 | res\drawable-xxhdpi 349 | 1 350 | 351 | 352 | res\drawable-xxhdpi 353 | 1 354 | 355 | 356 | 357 | 358 | res\drawable-xxxhdpi 359 | 1 360 | 361 | 362 | res\drawable-xxxhdpi 363 | 1 364 | 365 | 366 | 367 | 368 | res\drawable-small 369 | 1 370 | 371 | 372 | res\drawable-small 373 | 1 374 | 375 | 376 | 377 | 378 | res\drawable-normal 379 | 1 380 | 381 | 382 | res\drawable-normal 383 | 1 384 | 385 | 386 | 387 | 388 | res\drawable-large 389 | 1 390 | 391 | 392 | res\drawable-large 393 | 1 394 | 395 | 396 | 397 | 398 | res\drawable-xlarge 399 | 1 400 | 401 | 402 | res\drawable-xlarge 403 | 1 404 | 405 | 406 | 407 | 408 | res\values 409 | 1 410 | 411 | 412 | res\values 413 | 1 414 | 415 | 416 | 417 | 418 | 1 419 | 420 | 421 | Contents\MacOS 422 | 1 423 | 424 | 425 | 0 426 | 427 | 428 | 429 | 430 | Contents\MacOS 431 | 1 432 | .framework 433 | 434 | 435 | Contents\MacOS 436 | 1 437 | .framework 438 | 439 | 440 | 0 441 | 442 | 443 | 444 | 445 | 1 446 | .dylib 447 | 448 | 449 | 1 450 | .dylib 451 | 452 | 453 | 1 454 | .dylib 455 | 456 | 457 | Contents\MacOS 458 | 1 459 | .dylib 460 | 461 | 462 | Contents\MacOS 463 | 1 464 | .dylib 465 | 466 | 467 | 0 468 | .dll;.bpl 469 | 470 | 471 | 472 | 473 | 1 474 | .dylib 475 | 476 | 477 | 1 478 | .dylib 479 | 480 | 481 | 1 482 | .dylib 483 | 484 | 485 | Contents\MacOS 486 | 1 487 | .dylib 488 | 489 | 490 | Contents\MacOS 491 | 1 492 | .dylib 493 | 494 | 495 | 0 496 | .bpl 497 | 498 | 499 | 500 | 501 | 0 502 | 503 | 504 | 0 505 | 506 | 507 | 0 508 | 509 | 510 | 0 511 | 512 | 513 | 0 514 | 515 | 516 | Contents\Resources\StartUp\ 517 | 0 518 | 519 | 520 | Contents\Resources\StartUp\ 521 | 0 522 | 523 | 524 | 0 525 | 526 | 527 | 528 | 529 | 1 530 | 531 | 532 | 1 533 | 534 | 535 | 1 536 | 537 | 538 | 539 | 540 | 1 541 | 542 | 543 | 1 544 | 545 | 546 | 1 547 | 548 | 549 | 550 | 551 | 1 552 | 553 | 554 | 1 555 | 556 | 557 | 1 558 | 559 | 560 | 561 | 562 | 1 563 | 564 | 565 | 1 566 | 567 | 568 | 1 569 | 570 | 571 | 572 | 573 | 1 574 | 575 | 576 | 1 577 | 578 | 579 | 1 580 | 581 | 582 | 583 | 584 | 1 585 | 586 | 587 | 1 588 | 589 | 590 | 1 591 | 592 | 593 | 594 | 595 | 1 596 | 597 | 598 | 1 599 | 600 | 601 | 1 602 | 603 | 604 | 605 | 606 | 1 607 | 608 | 609 | 1 610 | 611 | 612 | 1 613 | 614 | 615 | 616 | 617 | 1 618 | 619 | 620 | 1 621 | 622 | 623 | 1 624 | 625 | 626 | 627 | 628 | 1 629 | 630 | 631 | 1 632 | 633 | 634 | 1 635 | 636 | 637 | 638 | 639 | 1 640 | 641 | 642 | 1 643 | 644 | 645 | 1 646 | 647 | 648 | 649 | 650 | 1 651 | 652 | 653 | 1 654 | 655 | 656 | 1 657 | 658 | 659 | 660 | 661 | 1 662 | 663 | 664 | 1 665 | 666 | 667 | 1 668 | 669 | 670 | 671 | 672 | 1 673 | 674 | 675 | 1 676 | 677 | 678 | 1 679 | 680 | 681 | 682 | 683 | 1 684 | 685 | 686 | 1 687 | 688 | 689 | 1 690 | 691 | 692 | 693 | 694 | 1 695 | 696 | 697 | 1 698 | 699 | 700 | 1 701 | 702 | 703 | 704 | 705 | 1 706 | 707 | 708 | 1 709 | 710 | 711 | 1 712 | 713 | 714 | 715 | 716 | 1 717 | 718 | 719 | 1 720 | 721 | 722 | 1 723 | 724 | 725 | 726 | 727 | 1 728 | 729 | 730 | 1 731 | 732 | 733 | 1 734 | 735 | 736 | 737 | 738 | 1 739 | 740 | 741 | 1 742 | 743 | 744 | 1 745 | 746 | 747 | 748 | 749 | 1 750 | 751 | 752 | 1 753 | 754 | 755 | 1 756 | 757 | 758 | 759 | 760 | 1 761 | 762 | 763 | 1 764 | 765 | 766 | 1 767 | 768 | 769 | 770 | 771 | 1 772 | 773 | 774 | 1 775 | 776 | 777 | 1 778 | 779 | 780 | 781 | 782 | 1 783 | 784 | 785 | 1 786 | 787 | 788 | 1 789 | 790 | 791 | 792 | 793 | 1 794 | 795 | 796 | 1 797 | 798 | 799 | 800 | 801 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 802 | 1 803 | 804 | 805 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 806 | 1 807 | 808 | 809 | 810 | 811 | 1 812 | 813 | 814 | 1 815 | 816 | 817 | 818 | 819 | ..\ 820 | 1 821 | 822 | 823 | ..\ 824 | 1 825 | 826 | 827 | 828 | 829 | 1 830 | 831 | 832 | 1 833 | 834 | 835 | 1 836 | 837 | 838 | 839 | 840 | 1 841 | 842 | 843 | 1 844 | 845 | 846 | 1 847 | 848 | 849 | 850 | 851 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 852 | 1 853 | 854 | 855 | 856 | 857 | ..\ 858 | 1 859 | 860 | 861 | ..\ 862 | 1 863 | 864 | 865 | 866 | 867 | Contents 868 | 1 869 | 870 | 871 | Contents 872 | 1 873 | 874 | 875 | 876 | 877 | Contents\Resources 878 | 1 879 | 880 | 881 | Contents\Resources 882 | 1 883 | 884 | 885 | 886 | 887 | library\lib\armeabi-v7a 888 | 1 889 | 890 | 891 | library\lib\arm64-v8a 892 | 1 893 | 894 | 895 | 1 896 | 897 | 898 | 1 899 | 900 | 901 | 1 902 | 903 | 904 | 1 905 | 906 | 907 | Contents\MacOS 908 | 1 909 | 910 | 911 | Contents\MacOS 912 | 1 913 | 914 | 915 | 0 916 | 917 | 918 | 919 | 920 | library\lib\armeabi-v7a 921 | 1 922 | 923 | 924 | 925 | 926 | 1 927 | 928 | 929 | 1 930 | 931 | 932 | 933 | 934 | Assets 935 | 1 936 | 937 | 938 | Assets 939 | 1 940 | 941 | 942 | 943 | 944 | Assets 945 | 1 946 | 947 | 948 | Assets 949 | 1 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | True 965 | False 966 | 967 | 968 | 12 969 | 970 | 971 | 972 | 973 |
974 | -------------------------------------------------------------------------------- /samples/delphi/teste.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Vinicius 4 | Sanchez 5 | 6 | 7 | yes 8 | yes 9 | yes 10 | yes 11 | yes 12 | 13 | -------------------------------------------------------------------------------- /samples/lazarus/Samples.lpi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <Scaled Value="True"/> 10 | <ResourceType Value="res"/> 11 | <UseXPManifest Value="True"/> 12 | <XPManifest> 13 | <DpiAware Value="True"/> 14 | </XPManifest> 15 | <Icon Value="0"/> 16 | </General> 17 | <BuildModes> 18 | <Item Name="Default" Default="True"/> 19 | </BuildModes> 20 | <PublishOptions> 21 | <Version Value="2"/> 22 | <UseFileFilters Value="True"/> 23 | </PublishOptions> 24 | <RunParams> 25 | <FormatVersion Value="2"/> 26 | </RunParams> 27 | <RequiredPackages> 28 | <Item> 29 | <PackageName Value="LCL"/> 30 | </Item> 31 | </RequiredPackages> 32 | <Units> 33 | <Unit> 34 | <Filename Value="Samples.lpr"/> 35 | <IsPartOfProject Value="True"/> 36 | </Unit> 37 | <Unit> 38 | <Filename Value="views.samples.pas"/> 39 | <IsPartOfProject Value="True"/> 40 | <ComponentName Value="FrmSamples"/> 41 | <ResourceBaseClass Value="Form"/> 42 | <UnitName Value="Views.Samples"/> 43 | </Unit> 44 | </Units> 45 | </ProjectOptions> 46 | <CompilerOptions> 47 | <Version Value="11"/> 48 | <PathDelim Value="\"/> 49 | <Target> 50 | <Filename Value="Samples"/> 51 | </Target> 52 | <SearchPaths> 53 | <IncludeFiles Value="$(ProjOutDir)"/> 54 | <OtherUnitFiles Value="..\..\src"/> 55 | <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 56 | </SearchPaths> 57 | <Linking> 58 | <Debugging> 59 | <DebugInfoType Value="dsDwarf2Set"/> 60 | </Debugging> 61 | <Options> 62 | <Win32> 63 | <GraphicApplication Value="True"/> 64 | </Win32> 65 | </Options> 66 | </Linking> 67 | </CompilerOptions> 68 | <Debugging> 69 | <Exceptions> 70 | <Item> 71 | <Name Value="EAbort"/> 72 | </Item> 73 | <Item> 74 | <Name Value="ECodetoolError"/> 75 | </Item> 76 | <Item> 77 | <Name Value="EFOpenError"/> 78 | </Item> 79 | </Exceptions> 80 | </Debugging> 81 | </CONFIG> 82 | -------------------------------------------------------------------------------- /samples/lazarus/Samples.lpr: -------------------------------------------------------------------------------- 1 | program Samples; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX} 7 | cthreads, 8 | {$ENDIF} 9 | {$IFDEF HASAMIGA} 10 | athreads, 11 | {$ENDIF} 12 | Interfaces, // this includes the LCL widgetset 13 | Forms, Views.Samples 14 | { you can add units after this }; 15 | 16 | {$R *.res} 17 | 18 | begin 19 | RequireDerivedFormResource := True; 20 | Application.Scaled := True; 21 | Application.Initialize; 22 | Application.CreateForm(TFrmSamples, FrmSamples); 23 | Application.Run; 24 | end. 25 | 26 | -------------------------------------------------------------------------------- /samples/lazarus/teste.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <developer mvp="true"> 3 | <firstName>Vinicius</firstName> 4 | <lastName>Sanchez</lastName> 5 | <age /> 6 | <projects> 7 | <Boss>yes</Boss> 8 | <DataSet-Serialize>yes</DataSet-Serialize> 9 | <RESTRequest4Delphi>yes</RESTRequest4Delphi> 10 | <BCrypt>yes</BCrypt> 11 | <Horse>yes</Horse> 12 | </projects> 13 | </developer> -------------------------------------------------------------------------------- /samples/lazarus/views.samples.lfm: -------------------------------------------------------------------------------- 1 | object FrmSamples: TFrmSamples 2 | Left = 350 3 | Height = 307 4 | Top = 31 5 | Width = 635 6 | Caption = 'Samples' 7 | ClientHeight = 307 8 | ClientWidth = 635 9 | LCLVersion = '2.2.2.0' 10 | object mmXML: TMemo 11 | Left = 24 12 | Height = 225 13 | Top = 56 14 | Width = 585 15 | TabOrder = 0 16 | end 17 | object btnReadString: TButton 18 | Left = 24 19 | Height = 25 20 | Top = 15 21 | Width = 75 22 | Caption = 'Read string' 23 | OnClick = btnReadStringClick 24 | TabOrder = 1 25 | end 26 | object btnReadFile: TButton 27 | Left = 105 28 | Height = 25 29 | Top = 15 30 | Width = 75 31 | Caption = 'Read file' 32 | OnClick = btnReadFileClick 33 | TabOrder = 2 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /samples/lazarus/views.samples.pas: -------------------------------------------------------------------------------- 1 | unit Views.Samples; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | interface 6 | 7 | uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Xml.Reader; 8 | 9 | type 10 | TFrmSamples = class(TForm) 11 | btnReadFile: TButton; 12 | btnReadString: TButton; 13 | mmXML: TMemo; 14 | procedure btnReadFileClick(Sender: TObject); 15 | procedure btnReadStringClick(Sender: TObject); 16 | private 17 | procedure DoPrintElement(const AElement: IXmlElement); 18 | procedure DoPrintAttribute(const AAttribute: IXmlAttribute); 19 | procedure DoPrintNode(const ANode: IXmlNode); 20 | procedure Read(const AXml: IXmlReader); 21 | end; 22 | 23 | var 24 | FrmSamples: TFrmSamples; 25 | 26 | implementation 27 | 28 | {$R *.lfm} 29 | 30 | const 31 | XML = '<?xml version="1.0" encoding="UTF-8"?><developer mvp="true"><firstName>Vinicius</firstName>' + 32 | '<lastName>Sanchez</lastName><age/><projects><Boss>yes</Boss><DataSet-Serialize>yes</DataSet-Serialize>' + 33 | '<RESTRequest4Delphi>yes</RESTRequest4Delphi><BCrypt>yes</BCrypt><Horse>yes</Horse></projects></developer>'; 34 | 35 | procedure TFrmSamples.btnReadFileClick(Sender: TObject); 36 | begin 37 | Read(TXmlReader.New.LoadFromFile('teste.xml')); 38 | end; 39 | 40 | procedure TFrmSamples.btnReadStringClick(Sender: TObject); 41 | begin 42 | Read(TXmlReader.New.LoadFromString(XML)); 43 | end; 44 | 45 | procedure TFrmSamples.DoPrintElement(const AElement: IXmlElement); 46 | begin 47 | mmXML.Lines.Add('[Element] Name: ' + AElement.Name + ' value: ' + AElement.AsString); 48 | end; 49 | 50 | procedure TFrmSamples.DoPrintAttribute(const AAttribute: IXmlAttribute); 51 | begin 52 | mmXML.Lines.Add('[Attribute] Name: ' + AAttribute.Name + ' value: ' + AAttribute.AsString); 53 | end; 54 | 55 | procedure TFrmSamples.DoPrintNode(const ANode: IXmlNode); 56 | var 57 | LElement: IXmlElement; 58 | LAttribute: IXmlAttribute; 59 | LNode: IXmlNode; 60 | begin 61 | mmXML.Lines.Add('[Node] Name: ' + ANode.Name); 62 | 63 | for LAttribute in ANode.Attributes do 64 | DoPrintAttribute(LAttribute); 65 | 66 | for LElement in ANode.Elements do 67 | DoPrintElement(LElement); 68 | 69 | for LNode in ANode.Nodes do 70 | DoPrintNode(LNode); 71 | end; 72 | 73 | procedure TFrmSamples.Read(const AXml: IXmlReader); 74 | begin 75 | mmXML.Lines.Add('Version: ' + AXml.Version); 76 | mmXML.Lines.Add('Encoding: ' + AXml.Encoding); 77 | DoPrintNode(AXml.Node); 78 | end; 79 | 80 | end. 81 | 82 | -------------------------------------------------------------------------------- /src/Xml.Reader.Attribute.Intf.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Attribute.Intf; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | type 10 | IXmlAttribute = interface 11 | ['{9ABACA38-3FBF-4107-8263-03E2AA87C3E6}'] 12 | function Name: string; overload; 13 | function Name(const AName: string): IXmlAttribute; overload; 14 | function Value: Variant; overload; 15 | function Value(const AValue: Variant): IXmlAttribute; overload; 16 | function AsString: string; 17 | function AsInteger: Integer; 18 | end; 19 | 20 | implementation 21 | 22 | end. 23 | -------------------------------------------------------------------------------- /src/Xml.Reader.Attribute.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Attribute; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Attribute.Intf; 10 | 11 | type 12 | TXmlAttribute = class(TInterfacedObject, IXmlAttribute) 13 | private 14 | FName: string; 15 | FValue: Variant; 16 | function Name: string; overload; 17 | function Name(const AName: string): IXmlAttribute; overload; 18 | function Value: Variant; overload; 19 | function Value(const AValue: Variant): IXmlAttribute; overload; 20 | function AsString: string; 21 | function AsInteger: Integer; 22 | public 23 | class function New: IXmlAttribute; 24 | end; 25 | 26 | implementation 27 | 28 | uses 29 | {$IF DEFINED(FPC)} 30 | Variants, SysUtils; 31 | {$ELSE} 32 | System.Variants, System.SysUtils; 33 | {$ENDIF} 34 | 35 | { TXmlAttribute } 36 | 37 | function TXmlAttribute.AsInteger: Integer; 38 | begin 39 | Result := 0; 40 | if VarIsNumeric(FValue) then 41 | Result := FValue; 42 | end; 43 | 44 | function TXmlAttribute.AsString: string; 45 | begin 46 | Result := EmptyStr; 47 | if VarIsStr(FValue) then 48 | Result := FValue; 49 | end; 50 | 51 | function TXmlAttribute.Name: string; 52 | begin 53 | Result := FName; 54 | end; 55 | 56 | function TXmlAttribute.Name(const AName: string): IXmlAttribute; 57 | begin 58 | FName := AName; 59 | Result := Self; 60 | end; 61 | 62 | class function TXmlAttribute.New: IXmlAttribute; 63 | begin 64 | Result := TXmlAttribute.Create; 65 | end; 66 | 67 | function TXmlAttribute.Value(const AValue: Variant): IXmlAttribute; 68 | begin 69 | FValue := AValue; 70 | Result := Self; 71 | end; 72 | 73 | function TXmlAttribute.Value: Variant; 74 | begin 75 | Result := FValue; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /src/Xml.Reader.Element.Intf.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Element.Intf; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | type 10 | IXmlElement = interface 11 | ['{920ADF7E-DB8C-4A9A-919A-02C49BD618F4}'] 12 | function Name: string; overload; 13 | function Name(const AName: string): IXmlElement; overload; 14 | function Value: Variant; overload; 15 | function Value(const AValue: Variant): IXmlElement; overload; 16 | function AsString: string; 17 | function AsInteger: Integer; 18 | end; 19 | 20 | implementation 21 | 22 | end. 23 | -------------------------------------------------------------------------------- /src/Xml.Reader.Element.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Element; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Element.Intf; 10 | 11 | type 12 | TXmlElement = class(TInterfacedObject, IXmlElement) 13 | private 14 | FName: string; 15 | FValue: Variant; 16 | function Name: string; overload; 17 | function Name(const AName: string): IXmlElement; overload; 18 | function Value: Variant; overload; 19 | function Value(const AValue: Variant): IXmlElement; overload; 20 | function AsString: string; 21 | function AsInteger: Integer; 22 | public 23 | class function New: IXmlElement; 24 | end; 25 | 26 | implementation 27 | 28 | uses 29 | {$IF DEFINED(FPC)} 30 | Variants, SysUtils; 31 | {$ELSE} 32 | System.Variants, System.SysUtils; 33 | {$ENDIF} 34 | 35 | { TXmlElement } 36 | 37 | function TXmlElement.AsInteger: Integer; 38 | begin 39 | Result := 0; 40 | if VarIsNumeric(FValue) then 41 | Result := FValue; 42 | end; 43 | 44 | function TXmlElement.AsString: string; 45 | begin 46 | Result := EmptyStr; 47 | if VarIsStr(FValue) then 48 | Result := FValue; 49 | end; 50 | 51 | function TXmlElement.Name: string; 52 | begin 53 | Result := FName; 54 | end; 55 | 56 | function TXmlElement.Name(const AName: string): IXmlElement; 57 | begin 58 | FName := AName; 59 | Result := Self; 60 | end; 61 | 62 | class function TXmlElement.New: IXmlElement; 63 | begin 64 | Result := TXmlElement.Create; 65 | end; 66 | 67 | function TXmlElement.Value(const AValue: Variant): IXmlElement; 68 | begin 69 | FValue := AValue; 70 | Result := Self; 71 | end; 72 | 73 | function TXmlElement.Value: Variant; 74 | begin 75 | Result := FValue; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /src/Xml.Reader.Intf.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Intf; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Node.Intf; 10 | 11 | type 12 | IXmlReader = interface 13 | ['{B0700246-D6CF-4CA2-8AD8-5AAD0B317C8D}'] 14 | function LoadFromString(const AXml: string): IXmlReader; 15 | function LoadFromFile(const APath: string): IXmlReader; 16 | function Node: IXmlNode; 17 | function Version: string; 18 | function Encoding: string; 19 | end; 20 | 21 | implementation 22 | 23 | end. 24 | -------------------------------------------------------------------------------- /src/Xml.Reader.Node.Intf.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Node.Intf; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Element.Intf, Xml.Reader.Attribute.Intf, 10 | {$IF DEFINED(FPC)} 11 | Generics.Collections; 12 | {$ELSE} 13 | System.Generics.Collections; 14 | {$ENDIF} 15 | 16 | type 17 | IXmlNode = interface 18 | ['{4E1C725C-EFF4-43AB-820D-C3438A41D140}'] 19 | function Owner: IXmlNode; 20 | function GetAttribute(const AAttributeName: string): IXmlAttribute; 21 | function GetNode(const ANodeName: string): IXmlNode; 22 | function GetElement(const AElementName: string): IXmlElement; 23 | function Attributes: TList<IXmlAttribute>; 24 | function Nodes: TList<IXmlNode>; 25 | function Elements: TList<IXmlElement>; 26 | function ContainsAttribute(const AAttributeName: string): Boolean; 27 | function ContainsNode(const ANodeName: string): Boolean; 28 | function ContainsElement(const AElementName: string): Boolean; 29 | function Name: string; overload; 30 | function Name(const AName: string): IXmlNode; overload; 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /src/Xml.Reader.Node.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader.Node; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Node.Intf, Xml.Reader.Attribute.Intf, Xml.Reader.Element.Intf, 10 | {$IF DEFINED(FPC)} 11 | Generics.Collections; 12 | {$ELSE} 13 | System.Generics.Collections; 14 | {$ENDIF} 15 | 16 | type 17 | TXmlNode = class(TInterfacedObject, IXmlNode) 18 | private 19 | FName: string; 20 | FOwner: IXmlNode; 21 | FAttributes: TList<IXmlAttribute>; 22 | FNodes: TList<IXmlNode>; 23 | FElements: TList<IXmlElement>; 24 | function Owner: IXmlNode; 25 | function GetAttribute(const AAttributeName: string): IXmlAttribute; 26 | function GetNode(const ANodeName: string): IXmlNode; 27 | function GetElement(const AElementName: string): IXmlElement; 28 | function Attributes: TList<IXmlAttribute>; 29 | function Nodes: TList<IXmlNode>; 30 | function Elements: TList<IXmlElement>; 31 | function ContainsAttribute(const AAttributeName: string): Boolean; 32 | function ContainsNode(const ANodeName: string): Boolean; 33 | function ContainsElement(const AElementName: string): Boolean; 34 | function Name: string; overload; 35 | function Name(const AName: string): IXmlNode; overload; 36 | public 37 | constructor Create; overload; 38 | constructor Create(const AOwner: IXmlNode); overload; 39 | class function New(const AOwner: IXmlNode): IXmlNode; overload; 40 | class function New: IXmlNode; overload; 41 | destructor Destroy; override; 42 | end; 43 | 44 | implementation 45 | 46 | { TXmlNode } 47 | 48 | uses Xml.Reader.Element, Xml.Reader.Attribute; 49 | 50 | function TXmlNode.Attributes: TList<IXmlAttribute>; 51 | begin 52 | Result := FAttributes; 53 | end; 54 | 55 | function TXmlNode.ContainsAttribute(const AAttributeName: string): Boolean; 56 | var 57 | LAttribute: IXmlAttribute; 58 | begin 59 | Result := False; 60 | for LAttribute in FAttributes do 61 | begin 62 | Result := LAttribute.Name = AAttributeName; 63 | if Result then 64 | Break; 65 | end; 66 | end; 67 | 68 | function TXmlNode.ContainsElement(const AElementName: string): Boolean; 69 | var 70 | LElement: IXmlElement; 71 | begin 72 | Result := False; 73 | for LElement in FElements do 74 | begin 75 | Result := LElement.Name = AElementName; 76 | if Result then 77 | Break; 78 | end; 79 | end; 80 | 81 | function TXmlNode.ContainsNode(const ANodeName: string): Boolean; 82 | var 83 | LNode: IXmlNode; 84 | begin 85 | Result := False; 86 | for LNode in FNodes do 87 | begin 88 | Result := LNode.Name = ANodeName; 89 | if Result then 90 | Break; 91 | end; 92 | end; 93 | 94 | constructor TXmlNode.Create(const AOwner: IXmlNode); 95 | begin 96 | FOwner := AOwner; 97 | FAttributes := TList<IXmlAttribute>.Create; 98 | FNodes := TList<IXmlNode>.Create; 99 | FElements := TList<IXmlElement>.Create; 100 | end; 101 | 102 | constructor TXmlNode.Create; 103 | begin 104 | Create(nil); 105 | end; 106 | 107 | destructor TXmlNode.Destroy; 108 | begin 109 | if Assigned(FAttributes) then 110 | FAttributes.Free; 111 | if Assigned(FNodes) then 112 | FNodes.Free; 113 | if Assigned(FElements) then 114 | FElements.Free; 115 | inherited; 116 | end; 117 | 118 | function TXmlNode.Elements: TList<IXmlElement>; 119 | begin 120 | Result := FElements; 121 | end; 122 | 123 | function TXmlNode.GetAttribute(const AAttributeName: string): IXmlAttribute; 124 | var 125 | LAttribute: IXmlAttribute; 126 | begin 127 | for LAttribute in FAttributes do 128 | begin 129 | if LAttribute.Name = AAttributeName then 130 | begin 131 | Result := LAttribute; 132 | Break; 133 | end; 134 | end; 135 | if Result = nil then 136 | Result := TXmlAttribute.New; 137 | end; 138 | 139 | function TXmlNode.GetElement(const AElementName: string): IXmlElement; 140 | var 141 | LElement: IXmlElement; 142 | begin 143 | for LElement in FElements do 144 | begin 145 | if LElement.Name = AElementName then 146 | begin 147 | Result := LElement; 148 | Break; 149 | end; 150 | end; 151 | if Result = nil then 152 | Result := TXmlElement.New; 153 | end; 154 | 155 | function TXmlNode.GetNode(const ANodeName: string): IXmlNode; 156 | var 157 | LNode: IXmlNode; 158 | begin 159 | for LNode in FNodes do 160 | begin 161 | if LNode.Name = ANodeName then 162 | begin 163 | Result := LNode; 164 | Break; 165 | end; 166 | end; 167 | if Result = nil then 168 | Result := TXmlNode.New; 169 | end; 170 | 171 | function TXmlNode.Name: string; 172 | begin 173 | Result := FName; 174 | end; 175 | 176 | function TXmlNode.Name(const AName: string): IXmlNode; 177 | begin 178 | FName := AName; 179 | Result := Self; 180 | end; 181 | 182 | class function TXmlNode.New(const AOwner: IXmlNode): IXmlNode; 183 | begin 184 | Result := TXmlNode.Create(AOwner); 185 | end; 186 | 187 | class function TXmlNode.New: IXmlNode; 188 | begin 189 | Result := TXmlNode.Create; 190 | end; 191 | 192 | function TXmlNode.Nodes: TList<IXmlNode>; 193 | begin 194 | Result := FNodes; 195 | end; 196 | 197 | function TXmlNode.Owner: IXmlNode; 198 | begin 199 | Result := FOwner; 200 | end; 201 | 202 | end. 203 | -------------------------------------------------------------------------------- /src/Xml.Reader.pas: -------------------------------------------------------------------------------- 1 | unit Xml.Reader; 2 | 3 | {$IF DEFINED(FPC)} 4 | {$MODE DELPHI}{$H+} 5 | {$ENDIF} 6 | 7 | interface 8 | 9 | uses Xml.Reader.Intf, Xml.Reader.Attribute.Intf, Xml.Reader.Element.Intf, Xml.Reader.Node.Intf, 10 | {$IF DEFINED(FPC)} 11 | Classes, Generics.Collections; 12 | {$ELSE} 13 | System.Classes, System.Generics.Collections; 14 | {$ENDIF} 15 | 16 | type 17 | IXmlReader = Xml.Reader.Intf.IXmlReader; 18 | IXmlNode = Xml.Reader.Node.Intf.IXmlNode; 19 | IXmlElement = Xml.Reader.Element.Intf.IXmlElement; 20 | IXmlAttribute = Xml.Reader.Attribute.Intf.IXmlAttribute; 21 | 22 | TXmlReader = class(TInterfacedObject, IXmlReader) 23 | private 24 | FVersion: string; 25 | FEncoding: string; 26 | FNode: IXmlNode; 27 | procedure ReadXmlInfo(const AXml: string); 28 | procedure ParseXml(const AXml: TStringList); 29 | procedure ParseNode(const ANode: IXmlNode; const AXml: string); 30 | function GetNameXmlValue(const AXml: string): string; 31 | function GetAttributes(const AXml: string): TDictionary<string, string>; 32 | function LoadFromString(const AXml: string): IXmlReader; 33 | function LoadFromFile(const APath: string): IXmlReader; 34 | function Node: IXmlNode; 35 | function Version: string; 36 | function Encoding: string; 37 | public 38 | constructor Create; 39 | destructor Destroy; override; 40 | class function New: IXmlReader; 41 | end; 42 | 43 | implementation 44 | 45 | uses Xml.Reader.Attribute, Xml.Reader.Element, Xml.Reader.Node, 46 | {$IF DEFINED(FPC)} 47 | SysUtils; 48 | {$ELSE} 49 | System.SysUtils; 50 | {$ENDIF} 51 | 52 | { TXmlReader } 53 | 54 | constructor TXmlReader.Create; 55 | begin 56 | FNode := TXmlNode.New; 57 | end; 58 | 59 | destructor TXmlReader.Destroy; 60 | begin 61 | Node.Attributes.Clear; 62 | Node.Elements.Clear; 63 | Node.Nodes.Clear; 64 | inherited; 65 | end; 66 | 67 | function TXmlReader.Encoding: string; 68 | begin 69 | Result := FEncoding; 70 | end; 71 | 72 | function TXmlReader.LoadFromFile(const APath: string): IXmlReader; 73 | var 74 | LXml: TStringList; 75 | begin 76 | LXml := TStringList.Create; 77 | try 78 | LXml.LoadFromFile(APath); 79 | Result := LoadFromString(LXml.Text); 80 | finally 81 | LXml.Free; 82 | end; 83 | end; 84 | 85 | function TXmlReader.LoadFromString(const AXml: string): IXmlReader; 86 | var 87 | I: Int64; 88 | LClearXml, LLine, LLineTrim: string; 89 | LXml: TStringList; 90 | begin 91 | Result := Self; 92 | LXml := TStringList.Create; 93 | try 94 | LLine := EmptyStr; 95 | LClearXml := AXml.Replace(#0, EmptyStr); 96 | for I := 1 to Length(LClearXml) do 97 | begin 98 | LLine := LLine + LClearXml[I]; 99 | LLineTrim := LLine.Trim; 100 | if LLineTrim.StartsWith('<') and LLineTrim.EndsWith('>') then 101 | begin 102 | LXml.Add(LLineTrim); 103 | LLine := EmptyStr; 104 | end 105 | else if LLineTrim.EndsWith('<') and (LLineTrim.Length > 1) then 106 | begin 107 | LXml.Add(LLineTrim.Replace('<', EmptyStr)); 108 | LLine := '<'; 109 | end; 110 | end; 111 | ParseXml(LXml); 112 | finally 113 | LXml.Free; 114 | end; 115 | end; 116 | 117 | class function TXmlReader.New: IXmlReader; 118 | begin 119 | Result := TXmlReader.Create; 120 | end; 121 | 122 | function TXmlReader.Node: IXmlNode; 123 | begin 124 | Result := FNode; 125 | end; 126 | 127 | function TXmlReader.GetAttributes(const AXml: string): TDictionary<string, string>; 128 | var 129 | I: Integer; 130 | LKey, LValue: string; 131 | LReadingValue: Boolean; 132 | begin 133 | LReadingValue := False; 134 | Result := TDictionary<string, string>.Create(); 135 | for I := 1 to AXml.Length do 136 | begin 137 | if LReadingValue then 138 | begin 139 | if AXml[I] = '"' then 140 | begin 141 | if LValue.IsEmpty then 142 | Continue; 143 | Result.Add(LKey, LValue); 144 | LReadingValue := False; 145 | LValue := EmptyStr; 146 | LKey := EmptyStr; 147 | Continue; 148 | end; 149 | LValue := LValue + AXml[I]; 150 | Continue; 151 | end; 152 | LReadingValue := AXml[I] = '='; 153 | if LReadingValue then 154 | Continue; 155 | if AXml[I] = ' ' then 156 | LKey := EmptyStr 157 | else 158 | LKey := LKey + AXml[I]; 159 | end; 160 | end; 161 | 162 | function TXmlReader.GetNameXmlValue(const AXml: string): string; 163 | var 164 | I: Integer; 165 | begin 166 | Result := EmptyStr; 167 | for I := 1 to AXml.Length do 168 | begin 169 | if (AXml[I] = '<') or ((AXml[I] = '>')) then 170 | Continue; 171 | if (AXml[I] = '/') and (AXml[Pred(I)] = '<') then 172 | Continue; 173 | if (AXml[I] = ' ') and (not Result.Trim.IsEmpty) then 174 | Break; 175 | Result := Result + AXml[I]; 176 | end; 177 | Result := Result.Trim; 178 | end; 179 | 180 | procedure TXmlReader.ParseNode(const ANode: IXmlNode; const AXml: string); 181 | var 182 | LAttribute: TPair<string, string>; 183 | LAttributes: TDictionary<string, string>; 184 | begin 185 | LAttributes := GetAttributes(AXml); 186 | try 187 | ANode.Name(GetNameXmlValue(AXml)); 188 | for LAttribute in LAttributes do 189 | ANode.Attributes.Add(TXmlAttribute.New.Name(LAttribute.Key).Value(LAttribute.Value)); 190 | finally 191 | LAttributes.Free; 192 | end; 193 | end; 194 | 195 | procedure TXmlReader.ParseXml(const AXml: TStringList); 196 | var 197 | I: Integer; 198 | LLastNode: IXmlNode; 199 | LLastElement: IXmlElement; 200 | begin 201 | for I := 0 to Pred(AXml.Count) do 202 | begin 203 | if AXml[I].StartsWith('</') then 204 | begin 205 | if AXml[Pred(I)].StartsWith('<') then 206 | begin 207 | if Assigned(LLastNode.Owner) then 208 | LLastNode := LLastNode.Owner; 209 | end; 210 | Continue; 211 | end 212 | else if AXml[I].StartsWith('<?') then 213 | ReadXmlInfo(AXml[I]) 214 | else if AXml[I].EndsWith('/>') then 215 | begin 216 | LLastElement := TXmlElement.New.Name(GetNameXmlValue(AXml[I])); 217 | LLastNode.Elements.Add(LLastElement); 218 | end 219 | else if AXml[I].StartsWith('<') and AXml[I].EndsWith('>') then 220 | begin 221 | if AXml[Succ(I)].StartsWith('<') then 222 | begin 223 | if FNode.Name.Trim.IsEmpty then 224 | LLastNode := FNode 225 | else 226 | begin 227 | LLastNode.Nodes.Add(TXmlNode.New(LLastNode)); 228 | LLastNode := LLastNode.Nodes.Last; 229 | end; 230 | ParseNode(LLastNode, AXml[I]); 231 | end 232 | else 233 | begin 234 | LLastElement := TXmlElement.New.Name(GetNameXmlValue(AXml[I])); 235 | LLastNode.Elements.Add(LLastElement); 236 | end; 237 | end 238 | else 239 | LLastElement.Value(AXml[I]); 240 | end; 241 | end; 242 | 243 | procedure TXmlReader.ReadXmlInfo(const AXml: string); 244 | var 245 | LAttribute: TPair<string, string>; 246 | LAttributes: TDictionary<string, string>; 247 | begin 248 | LAttributes := GetAttributes(AXml); 249 | try 250 | for LAttribute in LAttributes do 251 | begin 252 | if LAttribute.Key.ToLower.Equals('version') then 253 | FVersion := LAttribute.Value 254 | else if LAttribute.Key.ToLower.Equals('encoding') then 255 | FEncoding := LAttribute.Value; 256 | end; 257 | finally 258 | LAttributes.Free; 259 | end; 260 | end; 261 | 262 | function TXmlReader.Version: string; 263 | begin 264 | Result := FVersion; 265 | end; 266 | 267 | end. 268 | --------------------------------------------------------------------------------