Click here to Skip to main content
13,299,495 members (72,326 online)
Click here to Skip to main content
Add your own
alternative version


70 bookmarked
Posted 25 Oct 2005

XML Editor

, 25 Oct 2005
Rate this:
Please Sign up or sign in to vote.
XML Editor with intellisense, automatic tag completion and parsing etc...

Screen Shot 1


I have read and downloaded many articles and source code from CodeProject, and now I am trying to payback. Recently I had to develop a small and simple XML editor for a data conversion company. We shall discuss the scenario here.

Before I start, I just want to say that I am a new kid in .NET and the contents of this article/source code are not very professional, it is only for beginners. You may have better or simple ways to establish these goals. Anyway I would love to hear from you. I am very much interested in improving my skills. So, if you have any comments, please drop me a mail or post a feedback.

What is an XML Editor?

As far as I know, an XML editor should have all the necessary functionalities of a text editor, plus some extra functionalities like parsing, Intellisense (showing available tags when user types the '<' symbol), output viewing etc.


To fetch available elements and attributes of XML document, we need to read DTD/Schema (Here I am using DTD). Regular Expression is the easiest way to establish this task, just read DTD using StreamReader and extract elements and attributes using Regular Expression and store them in a DataTable.

In XML, we have elements and attributes. What we want is, when a user presses '<' it should pop a list of elements and the selected tag should be inserted at that location. When the user presses '<' and the '/' symbol, the last opened tag should be closed automatically. This can be done by using the Stack class (which provides a simple last-in-first-out collection of objects).

Screen Shot

Next we want to format the XML file with proper indentation. Here also I use Regular Expressions to solve the issue. Browse the source code for details, it is almost self-describing. Parsing is the next issue, you can do this by simply importing the XML assembly and using the XmlValidatingReader class.

Happy coding....


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Kannan KR
Software Developer (Senior)
India India
A Software Engineer from Kerala, working in New Delhi, INDIA email: |

You may also be interested in...

Comments and Discussions

GeneralNice Project Pin
ishwarya mahadevan17-Feb-10 18:33
memberishwarya mahadevan17-Feb-10 18:33 
GeneralFunctionality Pin
preneha20-Nov-08 22:40
memberpreneha20-Nov-08 22:40 
QuestionComplex DTDs? Pin
forw15-Nov-06 2:34
memberforw15-Nov-06 2:34 
QuestionUTF-16 Pin
Play4fun8-Nov-06 3:13
memberPlay4fun8-Nov-06 3:13 
GeneralGreat !!! Pin
Mr.No1-Nov-05 4:06
memberMr.No1-Nov-05 4:06 
QuestionHow to Syntax Highlighting Pin
HenBlg27-Oct-05 0:45
memberHenBlg27-Oct-05 0:45 
AnswerRe: How to Syntax Highlighting Pin
Kannan KR30-Oct-05 14:13
memberKannan KR30-Oct-05 14:13 
GeneralRe: How to Syntax Highlighting Pin
HenBlg30-Oct-05 18:44
memberHenBlg30-Oct-05 18:44 
So How is the proper way to do syntax highlighting?
It'd be great if you can also add this feature to your xml editor.
GeneralRe: How to Syntax Highlighting Pin
Abrian31-Oct-05 21:31
memberAbrian31-Oct-05 21:31 
QuestionXML Editor Pin
bbrandin25-Oct-05 23:53
memberbbrandin25-Oct-05 23:53 
AnswerRe: XML Editor Pin
Kannan KR26-Oct-05 8:29
memberKannan KR26-Oct-05 8:29 
GeneralHi Nice Porject! Pin
Jonathan L. Nazario25-Oct-05 13:40
memberJonathan L. Nazario25-Oct-05 13:40 
GeneralRe: Hi Nice Porject! Pin
Kannan KR25-Oct-05 14:47
memberKannan KR25-Oct-05 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171207.1 | Last Updated 25 Oct 2005
Article Copyright 2005 by Kannan KR
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid