an********@gmail.com wrote:
There's an XML page with RDF information inside. I want to simply get
the source of this page and save it in a file.(basically i want to do
a 'save as' without prompting the user.
I'll use the FSO for putting it into the file
There is no FileSystemObject in the Gecko DOM, it is IE (DOM)-only.
You will have to use interfaces defined by the DOM Level 3 Load And
Save Specification or use the filesystem interfaces native to the
Gecko DOM. IIRC this has been asked and answered here before.
but to get the source of the page in a variable :
I think document.body or document.html do not work in Firefox.
document.body is a property defined in W3C DOM Level 2 _HTML_ as a shortcut
reference to the sole HTMLBodyElement object in the document tree of
(X)HTML documents. It is not available for non-(X)HTML document types,
of course.
There is no such property as `document.html' for any supported document type
in the Gecko DOM.
Also document.documentElement.getElementByTagName('xml' )[0].innerHTML is
of no good.
Because you are not dealing with an (X)HTML document. Furthermore, the
method identifier is `getElementsByTagName', not `getElementByTagName'.
Any ideas ?
var x = new XMLHttpRequest();
x.open('GET', 'http://example.com/blurb.rdf');
x.onreadystatechange = function()
{
if (x.readyState == 4 && /^[02]/.test(x.status))
{
window.alert(x.responseText);
}
};
x.send(null);
HTH
PointedEars