Hi all, I'm supposed to take an app which can parse the info of an xml document and output it into readable info, however I have no idea where to begin...
This is what I have so far:

private void button1_Click(object sender, EventArgs e)

            XmlTextReader read = new XmlTextReader(@"C:\Documents and Settings\John\Desktop\content.xml");
            this.richTextBox1.Text = read.ToString();


Obviously it's not close to working. It just displays 'System.Xml.XmlTextReader' into the textbox. Any help would be appreciated.

Recommended Answers

All 6 Replies

You can't very well convert an XML document in to something "human readable" without knowing the structure of the document. Elements could contain any number of child elements, etc etc. XML by itself is fairly readable if you understand you're looking at related data in my opinion.

I see. Well, here's a small example of what it looks like:

<text:p text:style-name="P9">DEVELOPER SUPPORT SPECIALIST</text:p> 
  <text:p text:style-name="P10">SUMMARY OF QUALIFICATIONS / ACHIEVEMENTS</text:p> 
- <text:p text:style-name="P11">

Do you know how I could output that as plain readable text?

How do you want it formatted? That is the real question. And will it always be the same format or are you wanting this generic for all XML files?

I was wanting it to be able to be read into a rich textbox in plain text, without the xml tags. So, say, maybe I could have a open file dialog box and when someone selected an xml file, it would be put into plain text into the rich textbox (by plain text i mean the text without the xml tags). Thanks for your help.

Ok, thanks Scott.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.