In 2022: Which Telerik Winform Control can be used to display a XML file|string like IE does?

1 Answer 87 Views
General Discussions
Stefan
Top achievements
Rank 1
Stefan asked on 11 Nov 2022, 12:53 PM
I hope that I could use TreeView but there is no option, only to load XML which needs a TreeView definition structure.
(same hope I had for JSON)

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Nov 2022, 01:51 PM

Hello, Stefan,

It is possible to read the XML file and fill a DataSet with the content. Then, this DataSet can be used as RadTreeView.DataSource. Please refer to the following help article: https://docs.telerik.com/devtools/winforms/controls/treeview/data-binding/binding-to-xml-data 

This is applicable if the XML data defines self-referencing hierarchy that should be displayed in the nested structure that RadTreeView does.

However, the IE browser displays the file's content. That is why it is more suitable to use RadSyntaxEditor: https://docs.telerik.com/devtools/winforms/controls/syntax-editor/overview 

Since the RadSyntaxEditor control works with the underlying document with the help of taggers, taggers are used to identify spans of text and assign them a specific tag if they match a specific condition. RadSyntaxEditor comes with a number of predefined taggers one of which is the XmlTagger responsible for the syntax-highlighting in the XML programming language:

https://docs.telerik.com/devtools/winforms/controls/syntax-editor/features/taggers/overview 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Stefan
Top achievements
Rank 1
commented on 11 Nov 2022, 04:05 PM

Hello Dess,

my understanding this is only for serialized xml data of/for the Treeview, not for displaying the content of any hierarchical XML file which I'd like to have to display the content of the XML in this control.
Very often users asked the same and are pointed to it.
Then I could parse the XML an created the nodes manually as I did for JSON files, where nothing is avail for a structured view.
I will try the editor...

https://docs.telerik.com/devtools/winforms/controls/treeview/data-binding/binding-to-xml-data 



Dess | Tech Support Engineer, Principal
Telerik team
commented on 15 Nov 2022, 11:16 AM

Hi, Stefan,

Yes, RadTreeView displays the actual hierarchical structure defined in the XML with the previously referred article:

treeview-data-binding-binding-to-xml-data 001

RadSyntaxEditor will display the content as a text editor:

Feel free to use this control which suits your requirements best.

 

Tags
General Discussions
Asked by
Stefan
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or