Hi guys, I have a template html that I first load. Then I add a bunch of other content trough DOM.
I want to save this changed content but SaveCurrent() saves only the file loaded with OpenURI(), not the content that is shown in the webcontrol. Is this a bug? Is there a fix available?
Tnx,
Zoran
Kirix Support Forums
SaveCurrent() ignores changes trough DOM
4 posts
• Page 1 of 1
- xzminx
- Registered User
- Posts: 12
- Joined: Tue Apr 26, 2011 1:51 pm
Re: SaveCurrent() ignores changes trough DOM
SaveCurrent() is pretty much a direct passthrough to XR SaveURI():
So searching for answers via SaveURI() is probably going to get you farther in your quest. I'd be willing to implement any changes to make this work better.
Best,
Ben
- Code: Select all
nsresult res = persist->SaveURI(nsnull, // url - nsnull equals "this document"
nsnull, // cache key
nsnull, // nsIURI referrer
nsnull, // post data
nsnull, // extra headers
file.p); // target file
So searching for answers via SaveURI() is probably going to get you farther in your quest. I'd be willing to implement any changes to make this work better.
Best,
Ben
Ben Williams
Kirix Support Team
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: SaveCurrent() ignores changes trough DOM
Meh, I just made my own DOM printer, it was quicker than tracing and fixing the XR's SaveURI().
- xzminx
- Registered User
- Posts: 12
- Joined: Tue Apr 26, 2011 1:51 pm
Re: SaveCurrent() ignores changes trough DOM
Here's how I did it:
As pointed out, the SaveURI method doesn't show any changes to the document since it was loaded. However there is another ns method called SaveDocument which will do the trick. I created a new method called SaveDocument in webControl.cpp where I added the following code (and of course the corresponding declaration in the header):
Regards,
Robin
As pointed out, the SaveURI method doesn't show any changes to the document since it was loaded. However there is another ns method called SaveDocument which will do the trick. I created a new method called SaveDocument in webControl.cpp where I added the following code (and of course the corresponding declaration in the header):
- Code: Select all
bool wxWebControl::SaveDocument(
const wxString& filename)
{
ns_smartptr<nsIWebBrowserPersist> persist = m_ptrs->m_web_browser;
if (persist.empty())
{
wxFAIL_MSG(wxT("wxWebControl::SaveDocument(): nsIWebBrowserPersist interface not available"));
return false;
}
ns_smartptr<nsILocalFile> file = nsNewLocalFile(filename);
if (file.empty())
{
wxFAIL_MSG(wxT("wxWebControl::SaveDocument(): could not create temporary file"));
return false;
}
nsresult res = persist->SaveDocument(
nsnull, //in nsIDOMDocument aDocument,
file.p, //in nsISupports aFile,
nsnull, //in nsISupports aDataPath,
nsnull, //in string aOutputContentType,
nsnull, //in unsigned long aEncodingFlags,
nsnull //in unsigned long aWrapColumn
);
if (NS_FAILED(res))
return false;
return true;
}
Regards,
Robin
- rbalean
- Registered User
- Posts: 4
- Joined: Thu Sep 13, 2012 3:12 am
4 posts
· Page 1 of 1
Return to wxWebConnect Questions, Thoughts & Feedback