I could be wrong, I think you may need to write one for yourself...
On the second thought you may not need such thing at all, what exactly is you intent to do?
1) I have a html file test.html
############
-------------
test.html
-------------
<html>
<head>
<script>
function getXmlhttp() {
if(window.XMLHttpRequest) {
var xmlhttp = new XMLHttpRequest();
} else {
try {
var xmlhttp = new ActiveXObject( 'Microsoft.XMLHTTP' );
} catch(ee) {
try {
var xmlhttp = new ActiveXObject( 'Microsoft.XMLDOM' );
} catch(e) {
var xmlhttp = new ActiveXObject( 'Msxml2.XMLHTTP' );
}
}
}
return xmlhttp;
}
function updatehtml(val) {
/* I am sending this value through ajax to update it in the temporary html file like test.html~*/
var xmlhttp = new getXmlhttp();
xmlhttp.open("POST", "update.do" , true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
alert(xmlhttp.responseText);
}
}
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
xmlhttp.send("value="+val);
}
function savehtml() {
/* I am copying the temp html file to original html file and then delete the temp html file through ajax*/
var xmlhttp = new getXmlhttp();
xmlhttp.open("POST", "save.do" , true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
alert(xmlhttp.responseText);
}
}
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
xmlhttp.send(null);
}
I wonder if org.w3c.dom would work. Th reason I say that is because the said package is mainly used for XML parsing and a good likely hood is that html document is not well formed xml document, therefore it will have problem loading that doc.
I'd like to see it work though cus I never used it with HTML and it will be a good info.
org.w3c.dom works for xml its one of the popular API used in Java for this purpose...you will have to post your code, the file to help us see what u have done and why it doesn't work. In addition to that, post what errors you got.
post your code and your XHTML (as Khalid mentioned). Don't use HTML anymore for stuff like this if you want to use DOM... it's just about standards and having well formatted pages. if your HTML isn't well formatted..then how can you really manipulate it?
Bookmarks