XML Document from InnerHTML

S

SJ

Hi,

So I am trying to save off my source HTML to an xml document in order
to cache a large view within my ajax app.

For those of you familiar with this, the innerHTML does not preserve
the quotes around attributes so creating the xml document from
innerHTML is a pain (in IE).

The way I am doing it now is by calling
xmldoc.loadXML( addQuotesToAttributes(document.body.innerHTML)).

The problem is that the addQuotesToAttributes (which I wrote) can
take some time. Does anyone know an easier way to do this? Using Ajax
to request the xml info from the DB is not a good option for me.

Thanks,
-SJ
 
S

SJ

SJ said the following on 4/10/2007 12:01 PM:




IE doesn't do it wrong though as attributes are not required to be
quoted unless they contain characters that require quoting (ex: space).


Loop through the body and any and all attributes simply add a space to
the end of it and IE will quote it. When you get ready to save it or
reprocess it strip the space.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Thanks for the reply I will give this a shot.

-SJ
 
S

SJ

Thanks for the reply I will give this a shot.

-SJ- Hide quoted text -

- Show quoted text -

Ok, how do i get all the attributes in a body (and of course the child
elements as well) :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top