[Project_owners] Load HTML into DOM?
ajvincent at gmail.com
Thu Feb 10 17:46:37 EST 2005
Typically, with responseXML, there will still be a document, even if
the string you passed in is not well-formed. However, the root
element for such a document, if the string is not well-formed XML,
will be <parsererror/>. :-)
On Thu, 10 Feb 2005 17:42:52 -0800, Bradley Rintoul
<brintoul at sbcglobal.net> wrote:
> Konstantin Svist wrote:
> >umm... why don't you just use responseXML instead of responseText -
> >that returns a DOM structure
> >don't forget to set the request header to ---===Content-Type:
> >text/xml===---, though :)
> >On Thu, 10 Feb 2005 12:40:37 -0400, Christopher Ottley
> ><xknight at users.sourceforge.net> wrote:
> >>Bradley Rintoul wrote:
> >>>So I'm trying to create a new document using
> >>>document.implementation.createDocument and setting its innerHTML to
> >>>the responseText, but so far no luck. Do I need to create a "root
> >>>element" in the newly created DOMDocument..?
> >>You could try to use createContextualFragment to parse "unsafe" html.
> >>You can have a gander at this page
> >> http://webfx.eae.net/dhtml/mozInnerHTML/mozInnerHtml.html
> >>To see how it's used. That guy simulated innerHTML using
> >>createContextualFragment. A bit old, but might help you.
> >>Project_owners mailing list
> >>Project_owners at mozdev.org
> >Project_owners mailing list
> >Project_owners at mozdev.org
> Thanks to all who responded. Thing is, I'm not entirely sure that the
> HTML returned from my XmlHttpRequest is well-formed XML. I'll check it
> out, but I will also check out some of the other suggestions that were
> made. Thanks again!
> Project_owners mailing list
> Project_owners at mozdev.org
"The first step in confirming there is a bug in someone else's work is
confirming there are no bugs in your own."
-- Alexander J. Vincent, June 30, 2001
More information about the Project_owners