| Newsgroups |
gmane.comp.mozilla.devel.dom |
| Organization |
http://groups.google.com |
| Message-ID |
<[email protected]> |
Trying to save a DOM after minor manipulation using c++ embedded app
but two issues arise:
(1) The html saved using saveDocument has some static text doubled.
Note on this page, happens regardless if manipulate DOM or not. But
saveURi does not show duplicate static text.
For example, if the text on the page is "4. Time in minutes: ", then
when the page is saved using saveDocument the text is "4. 4. Time in
minutes". The "4." is doubled for some reason. This does not happen
with saveURI.
(2) If the DOM is manipulated through code, for example, increase the
rows of a textarea, the new saved textarea will increase in size only
if no data was present. Additionally added text to a text area,
either previously with or without data shows no change in the saved
html.
Note, only the saved portion of code is shown because the running
embedded browser application shows the proper page loaded with all
changes to the text area in real-time. The save is done after the
document loads successfully and text areas are changed through code.
The domDoc value is the pointer to the changed DOM.
saveDocument has shown one increase in a textarea of rows only if the
textarea was empty to begin with. Other than that the page is okay
except for some duplicated static text.
The code below is just one current attempt. The encoding flags and
persist flags have been changed repeatedly but always the same
results.
I'm using the latest builds 1.9. firefox-3.0b3-source.tar.bz2.
xulrunner-1.9b5pre.en-US.win32.zip.
Is this source code not stable? What can I build with VS2005 that
will work?
Thanks for any help regarding this issue.
<< code snippet>>
PRUint32 encodingFlags =
nsIWebBrowserPersist::ENCODE_FLAGS_CR_LINEBREAKS|
nsIWebBrowserPersist::ENCODE_FLAGS_LF_LINEBREAKS|
nsIWebBrowserPersist::ENCODE_FLAGS_SELECTION_ONLY;
PRUint32 wrapColumn = 0;
const char contentType[30] = "text/html;charset=UTF-8";
nsCOMPtr<nsILocalFile> someDir = nsnull;
nsCOMPtr<nsILocalFile> somePath = nsnull;
nsCString path( "C:\\MozillaDocs\\myDoc_savdoc.htm");
NS_NewNativeLocalFile(path,PR_TRUE,getter_AddRefs(someDir));
nsCString datapath( "C:\\MozillaDocs");
NS_NewNativeLocalFile(datapath,PR_TRUE,getter_AddRefs(somePath));
persist->SetPersistFlags(
nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWebBrowserPersist::PERSIST_FLAGS_FROM_CACHE |
nsIWebBrowserPersist::PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION|
nsIWebBrowserPersist::PERSIST_FLAGS_FIXUP_ORIGINAL_DOM);
persist->SaveDocument(domDoc, someDir, somePath, contentType,
encodingFlags, wrapColumn);