|
-
Dec 23rd, 2009, 02:19 PM
#1
Thread Starter
New Member
Newb workin on a simple txt -> xml program
Hey there,
I have this Quiz software that lets you create online multiple choice quizzes which are great for studying (I am in grad school and I'm trying to use everything I can to learn). So the Quiz software is great but it only lets you input questions by hand, one by one. I took a look at the .xml file that the quiz program spits out and came up with the idea to try and make a converter so that I can import many questions at once. I was hoping to try and solve this limitation by doing the following:
Take a .doc that say a tutor gives us with a bunch of practice questions, and then take that into Crimson Editor, and then format it so the question is on line 1, the multiple choice answers are on lines 3,4,5, and 6, (for the next question, the question would be on line 11, and the answers on lines 13, 14, 15, and 16, and so on) and then take that saved .txt file into my program, hit the generate button, and it will spit out the .xml file, and then import that into the quiz software to generate the online quiz.
Here is an attached screenshot of my program layout so far:

I figured out how to open a text file by watching simple youtube tutorials, but I don't know how to have it generate the stuff and have it show up in the bottom text box. I know how to do the coding to convert the txt to proper xml code but I don't know how to be able to save the contents of the bottom text window to an xml file.
Do you happen to know of any programs with source code that do something similar that are simple and easy to read through? Or any websites with some tutorials that could help me out? Thanks, I appreciate any help
-
Dec 23rd, 2009, 05:13 PM
#2
Re: Newb workin on a simple txt -> xml program
So your question is once you have valid XML code in the bottom textbox, you want to know what code to put in the "save xml file" button to save that data to an xml file, correct?
It is actually very simple, you just parse the text into an xdocument, and then save it.
Code:
'where txtXMLOutput is the bottom textbox name
Dim myXMLDoc As XDocument = XDocument.Parse(txtXMLOutput.Text)
myXMLDoc.Save("C:\somefile.xml")
you might want to include a savefiledialog in there too, so that you can prompt for a filename instead of a hard coded file name like the above example.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|