Hi - I'm builing a content management system, so I have xml along the lines of:
So I use javascript on the server side to output the <content> element:
I then edit that content & try to save it back to the XML file.
On the client-side:
I pass this to a hidden <input>, and submit the form. On the server-side I then:
But then on Response.Write(newContent.xml) i get 'object required'.
What is the proper way of doing this? I feel I should be able to basically do something along the lines of output from file using document.getElementById('content') = object.xml, and then save by doing object.xml = document.getElementById('content') - I want to do it using a proper, standard method.
object.xml is of course read-only. Is it something to do with parsing? or httpxml? I'm new to these concepts and using xml.
Thanks a lot all,
Iain
Code:
<site>
<page id="1">
<title></title>
<content>
<div id="content"><p>This is my content</p></div>
</content>
</page>
</site>
So I use javascript on the server side to output the <content> element:
Code:
Response.Write(webpage.selecSingeNode("content").xml);
I then edit that content & try to save it back to the XML file.
On the client-side:
Code:
var xml = document.getElementById('content').innerHTML;
I pass this to a hidden <input>, and submit the form. On the server-side I then:
Code:
var newContent = "<content>" + Request.Form("contentContainer") + "</content>";
var newContentFile = new ActiveXObject("Microsoft.XMLDOM");
newContentFile.async = false;
newContentFile.loadXML(newContent);
newContent = newContentFile.documentElement;
But then on Response.Write(newContent.xml) i get 'object required'.
What is the proper way of doing this? I feel I should be able to basically do something along the lines of output from file using document.getElementById('content') = object.xml, and then save by doing object.xml = document.getElementById('content') - I want to do it using a proper, standard method.
object.xml is of course read-only. Is it something to do with parsing? or httpxml? I'm new to these concepts and using xml.
Thanks a lot all,
Iain