ChrisChuah 0 Posted August 28, 2022 Hi Is there a XML Viewer component rather than using the TWebBrowser component? Although i can use the TMemo component to load the xml but the output is not that pretty. Please advise regards chris Share this post Link to post
ertank 27 Posted August 28, 2022 (edited) Since you try to display an XML in a Memo control, I presume you are using considerable sized XML files and do not need things like coloring/styling. You can use a code like below to "pretty print" your XML and display it in a Memo object. uses Xml.xmldom, Xml.XMLIntf, // Interface Xml.XMLDoc; // TXMLDocument, FormatXMLData() procedure TForm1.Button1Click(Sender: TObject); var LXML: IXMLDocument; begin LXML := NewXMLDocument(); LXML.LoadFromXML('<?xml version="1.0" encoding="UTF-8"?><some_node><another_node>node value</another_node></some_node>'); LXML.XML.Text := FormatXMLData(LXML.XML.Text); Memo1.Text := LXML.XML.Text; end; Documentation says about TMemo "Under Win 9x, there is a limit of 64k of text for this control" Edited August 28, 2022 by ertank Share this post Link to post
MarkShark 27 Posted August 28, 2022 SynEdit (https://github.com/TurboPack/SynEdit) can handle huge files and has an XML highlighter (Note: I haven't used that highlighter myself.) 1 Share this post Link to post
Anders Melander 1782 Posted August 28, 2022 Something like this? The above was done with a standard TTreeView using ownerdraw (and "a few" hacks). I've attached the source but it's part of a larger framework so it will have to be tweaked a bit in order to work standalone - Minor stuff. If I were to implement this today I would definitely use Virtual TreeView instead; L oad the XML into a DOM (e.g. MSXML/IXMLDocument), populate the treeview and ownerdraw the nodes. amResourceViewXML.pas amResourceViewXML.dfm amTreeView.pas 1 Share this post Link to post
ChrisChuah 0 Posted August 29, 2022 tried to install the SynEdit via PackageManager and it could not be installed on Delphi 11.1 Anyone encountered this problem? regards chris Share this post Link to post
Brian Evans 105 Posted August 29, 2022 No problems encountered here. Expand the tree nodes and see more details on what is going wrong. Can also take a look in C:\Users\Public\Documents\Embarcadero\Studio\22.0 for GetItInstall.log which should also have the information on what happened. Share this post Link to post
ChrisChuah 0 Posted August 30, 2022 hi here is the getItInstall.log. From GitHub, it states that SynEdit supports up to Delphi 10.4 Could this error due to not able to support 11.1? regards chris ====== Start ====== [2022-08-29 09:28:55] [DEBUG] GetIt: Loading EULAS... [2022-08-29 09:29:02] [DEBUG] GetIt: Installing Library "SynEdit for VCL"... [2022-08-29 09:29:03] [DEBUG] GetIt: Downloading Library "SynEdit for VCL"... [2022-08-29 09:29:07] [DEBUG] GetIt: Extracting Library "SynEdit for VCL" to "C:\Users\chuahyen\Documents\Embarcadero\Studio\22.0\CatalogRepository\SynEdit-2022.03-11\". This could take a while... [2022-08-29 09:29:08] [DEBUG] GetIt: Compiling project "SynEditDR.dproj"... [2022-08-29 09:29:13] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Release" configuration. [2022-08-29 09:29:15] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Debug" configuration. [2022-08-29 09:29:17] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Release" configuration. [2022-08-29 09:29:18] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Debug" configuration. [2022-08-29 09:29:19] [DEBUG] GetIt: Error when executing an action of "SynEdit for VCL" catalog. The action is "CompileProject" (ID 6). [2022-08-29 09:29:19] [DEBUG] GetIt: A problem occurred during the process. [2022-08-29 09:29:26] [DEBUG] GetIt: Cancelling process... [2022-08-29 09:29:39] [DEBUG] GetIt: Loading EULAS... [2022-08-29 09:29:41] [DEBUG] GetIt: Installing Library "SynEdit for VCL"... [2022-08-29 09:29:41] [DEBUG] GetIt: Downloading Library "SynEdit for VCL"... [2022-08-29 09:29:42] [DEBUG] GetIt: Extracting Library "SynEdit for VCL" to "C:\Users\chuahyen\Documents\Embarcadero\Studio\22.0\CatalogRepository\SynEdit-2022.03-11\". This could take a while... [2022-08-29 09:29:42] [DEBUG] GetIt: Compiling project "SynEditDR.dproj"... [2022-08-29 09:29:45] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Release" configuration. [2022-08-29 09:29:47] [DEBUG] GetIt: Problem occurred when compiling for "Win64" platform with "Debug" configuration. [2022-08-29 09:29:48] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Release" configuration. [2022-08-29 09:29:50] [DEBUG] GetIt: Problem occurred when compiling for "Win32" platform with "Debug" configuration. [2022-08-29 09:29:50] [DEBUG] GetIt: Error when executing an action of "SynEdit for VCL" catalog. The action is "CompileProject" (ID 6). [2022-08-29 09:29:50] [DEBUG] GetIt: A problem occurred during the process. [2022-08-29 09:32:26] [DEBUG] GetIt: Cancelling process... ===== End ======= Share this post Link to post