How can I show formatted and colored XML in a C# application?

Posted on 2009-03-31
Last Modified: 2013-11-26
I currently have a textbox in my app that is used to display XML.  As you can imagine, the displayed XML doesn't look very nice.  I want to add color to my display (similar to what you'd get if you displayed XML in any XML viewer or from within Visual Studio).  Additional formatting would be nice, but isn't required.  What is the simplest control or method for doing this?
Question by:NewDawn
  • 2
  • 2
LVL 33

Expert Comment

by:Todd Gerbert
ID: 24032825
You might be able to embed an Internet Explorer WebBrowser in your form, though I'd guess that was read-only...
LVL 29

Expert Comment

ID: 24032895
If you just want to display - the easies method I believe is to use a web browser. You may apply a transformation style and you'll get nicely formatted colored xml. I can give you the solution.

However if you need to edit your xml the task is probably a bit more tricky. Not sure at the moment.

Author Comment

ID: 24033078
I need the XML to be editable.
LVL 33

Accepted Solution

Todd Gerbert earned 500 total points
ID: 24033246
I would Google around for a .Net XML WinForm control.  Looks like there might be one included in SharpDevelop, which is free.
LVL 29

Expert Comment

ID: 24034158

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now