Saving Jquery generated html content to xml

I am trying to create a fairly simple editor with the purpose of having an easy way to create questionnaires which will then be sent to customers to fill them out and have em sent back to us. So the editor part is done with jquery, i just add the desired html elements (text/buttons) on button click. The visual part works. Now of course a created template should be savable and loadable via xml.

The saving to file part is what I have not yet figured out.

The way I was about to go was just taking the whole html document and parse it via php. But this seems to be a non-ideal solution.

The problem is that my experience is fairly limited and I just wanted to do this as a convenience/hobby project so I constantly feel like I am doing things the stupid way. So I am completely open to whichever way is best to accomplish this task.

So to give you an example i would have created:

<input type="checkbox" id="checkId1" /><label for="checkId1">Sample Answer</label>
<textarea type="text" name="questionText" id="questionText1" value="Sample Question Text"></textarea>

and want to convert this to an xml that looks sort of like

<Question>
<QuestionType>CheckboxQuestion</QuestionType>
<QuestionText>Sample Question Text</QuestionText>
</Question>

Which I am then going to convert back to html when parsed with jquery.

Answers


     I think this is what you mean!

     1. you xml 
        <Question>
        <QuestionType>CheckboxQuestion</QuestionType>
         <QuestionText>Sample Question Text</QuestionText>
        </Question>
     2. Then parse xml using JS

         $.ajax({
                type:'GET',
                url:'your xml file',
                dataType:'xml',
                success: function(data){
                   $(data).find("Question").each(function(){

                 $('div.caption').append("<input type='checkbox' id='checkId1'>" 

                 +"<label for='checkId1'>"
                 +$(this).find('QuestionType').text()
                 +"</label>"
                 +"<textarea type='text' name='questionText' id='questionText1'" +"value='"$(this).find('QuestionText').text()"'>"
                +"$(this).find('QuestionText').text()"
                +"</textarea>");

                        });
                 } 
            });


     3. HTML <div class='caption'></div>

    Hope this will help! Tnx

Need Your Help

Asynchronous operation exception if I want to create an instance of a class

c# asp.net asp.net-3.5

I am currently working on a big asp.net page, created by a lot of other developers, used by a lot of people internally. I got a rather simple task to modify the page, for that I had to create a cla...

typed-Dataset VS Own access Database classes

sql-server-2005 stored-procedures strongly-typed-dataset

Hi i would like to know if it's better to use typed-dataset rather than Own access with Datareader and Store procedure?