Hi,

I found returning the HTML content could be done with the nsIDOMSerializer interface.
Below is the piece of code:
--- Snip ---
nsresult rv;
PRUnichar *serial;
nsCOMPtr<nsIDOMSerializer> serializer(do_CreateInstance(NS_XMLSERIALIZER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return;


nsCOMPtr<nsIDOMDocument> domDoc;
mWebNav->GetDocument(getter_AddRefs(domDoc));
rv = serializer->SerializeToString(domDoc, &serial); --- Snip ---


And I did loading a HTML page from a string with below piece of code:
--- Snip ---
 char *szHTMLText = "<html><h1>Stream Test</h1><body><p>This HTML \
   content is being loaded from a stream.</body></html>";

 nsCOMPtr<nsIDOMDocument> domDoc;
 mWebNav->GetDocument(getter_AddRefs(domDoc));

nsCOMPtr<nsIDOMHTMLDocument> domHtmlDoc(do_QueryInterface(domDoc));
domHtmlDoc->Open();
domHtmlDoc->Write(NS_LITERAL_STRING("<html><h1>Stream Test</h1><body><p>This HTML \
content is being loaded from a stream.</body></html>"));
domHtmlDoc->Close();
--- Snip ---


Both worked.

Thanks,
-George.

Sorry if this is a noobish question (i'm very new here)....

You can directly load a page from a string (rather than saving to a
local--or remote--file first)???

P.S.  There is a way to do this using the Internet Transfer Control in
VB, but I'm not sure if such a thing exists in (or applies to) Java.

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



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

Reply via email to