@Mike - I actually had that same function for a project I was working
on, and IE plain refused to convert it to a DOM that I could work
with.

In the end, I used a bit of substring parsing to get the contents of
the body, and dumped it in a hidden DIV (thus creating the DOM I
needed):

xml = xml.substring(xml.indexOf('<body>') + '<body>'.length);
xml = xml.substring(0, xml.indexOf('</body>'));

$('body').append('<div id="_xml"></div>');
$('_xml').hide().append(xml);

Pretty clunky but it did the job.


On May 16, 6:01 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> Here's a fn for converting strings to docs:
>
> function stringToDoc(s) {
>     var doc;
>     if (window.ActiveXObject) {
>         doc = new ActiveXObject('Microsoft.XMLDOM');
>         doc.async = 'false';
>         doc.loadXML(s);
>     }
>     else
>         doc = (new DOMParser()).parseFromString(s, 'text/xml');
>     return (doc && doc.documentElement && doc.documentElement.tagName
> != 'parsererror') ? doc : null;
>
> }
> > I would like to parse the return string as a dom document. It is impossible
> > for us to change the extension, so I was wondering if there is a possibility
> > to convert the return string to a dom document.

Reply via email to