Hi guys,
           I need some help here, currently i'm trying to save a DOM to a 
text or html file using the nsiwebbrowserpersist but the thing doesnt work . 
Below is my code. Have i miss out anything ..or is there anything i need to 
add in it to make it work. I'm not very sure the way to declare the 
localfile and the datapath ..dunno whether is it correct. Any kind soul can 
help me . Thanks


const webPersist = Components.interfaces.nsIWebBrowserPersist;
browseToURL: function(aURL)
  {

  try {
this.webNavigation.loadURI(aURL, nsIWebNavigation.LOAD_FLAGS_NONE, null, 
null, null);

var testDocument = this.webNavigation.document;

var file = "c:\\test2.htm";
var data = "c:\\test2_data";
var persistObj = 
Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(webPersist);
var aMimeType = "text/plain";
//actual files

var localFile = 
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);

localFile.initWithPath(file);

alert("test1");

//related files

var dataPath = 
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile)

dataPath.initWithPath(data);

alert("test2");

persistObj.persistFlags = persistObj.persistFlags

| webPersist.PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS

| webPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES

| webPersist.PERSIST_FLAGS_DONT_FIXUP_LINKS

| webPersist.PERSIST_FLAGS_DONT_CHANGE_FILENAMES

| webPersist.PERSIST_FLAGS_FIXUP_ORIGINAL_DOM;

persistObj.saveDocument(testDocument,localFile,dataPath,aMineType, 
outputFlags, 100);

alert("test3");


_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to