473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XMLDoc IE removes quotes - HELP

SJ
Dear Friends,

I am writing an ajax app and I use an XML doc to cache a view.

For example,

Before switching to another view, i do

cache = getXMLDoc(document.getElementById("source").innerH TML);

getXMLDoc just creates a XML object and calls the loadXML method.

Then later when I switch back, I just load do a

document.getElementById("source").innerHTML = cache.xml

The problem is that sometime IE will strip the quotes off the
innerHTML and cause the loading to fail.

For example, if do:

document.getElementById("source").innerHTML = "<table
class='myClass'></table>";

when I get that value
(alert(document.getElementById("source").innerHTML ) it shows as:

<table class=myClass></table>

Then when I try to do a loadXML it fails becuase it expects a qoute.
Anyone know how to get around this?

Thanks,
-SJ

Mar 7 '07 #1
2 2611
SJ wrote:
The problem is that sometime IE will strip the quotes off the
innerHTML and cause the loading to fail.

For example, if do:

document.getElementById("source").innerHTML = "<table
class='myClass'></table>";

when I get that value
(alert(document.getElementById("source").innerHTML ) it shows as:

<table class=myClass></table>
The property is called innerHTML, not innerXML, and IE serializes
according to text/html HTML rules and not according to XML rules. With
HTML it is allowed, for an attribute value like myClass to omit the
quotes. So don't use innerHTML if you want XML, you will need to write
your own serializer if you want to serialize the IE HTML DOM as XML.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 8 '07 #2
SJ
On Mar 8, 6:51 am, Martin Honnen <mahotr...@yahoo.dewrote:
SJ wrote:
The problem is that sometime IE will strip the quotes off the
innerHTML and cause the loading to fail.
For example, if do:
document.getElementById("source").innerHTML = "<table
class='myClass'></table>";
when I get that value
(alert(document.getElementById("source").innerHTML ) it shows as:
<table class=myClass></table>

The property is called innerHTML, not innerXML, and IE serializes
according to text/html HTML rules and not according to XML rules. With
HTML it is allowed, for an attribute value like myClass to omit the
quotes. So don't use innerHTML if you want XML, you will need to write
your own serializer if you want to serialize the IE HTML DOM as XML.

--

Martin Honnen
http://JavaScript.FAQTs.com/
thanks for the reply. I will try that.

Mar 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mudassar | last post by:
Hello I've been trying to figure this problem out for quite a while and I'm having no joy. I'll give you some background info, I'm creating a form and one of the fields in the form is a big ...
4
by: Ang Talunin | last post by:
Hey, I'm trying to read an xml from another webpage with: xmlDoc.load("http://www.otherwebsite.com/test.xml"); But this doesn't work...anybody knows a way to fix this? thnx, A.T.
11
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a...
1
by: Leonid | last post by:
we are using : var xmlfileLoaded = xmlDoc.load(xmlFileName); and we noticed that this files are not cached in numbers of clients Internet Exporer v6. We see in httprequest log this request. ...
9
by: M.Siler | last post by:
It is my understanding that XMLdoc only works for C#. I'd be glad to pay for a commercial product, but I want to make sure it is a good one, so I thought I'd ask here if anyone is using a product...
1
by: skastro | last post by:
Im having problems with the xmldoc returned by XMLHttpRequest.responseXML. alert( xmldoc.getElementsByTagName('element').firstChild.nodeValue.length ); if the text is bigger than 4096 bytes,...
2
by: KingdomHeart | last post by:
I recently write code to get IP address of my network devices in Call Manager. ANd I got problems with xmlhttp and xmldoc. what is wrong with these 2 lines below? xmlhttp.Send();...
5
by: Brigitte Behrmann | last post by:
Please can some-one help, I cannot get this to work. <html> <head> <title>Random Proverbs</title> <script type="text/javascript"> <!-- HIDE FROM INCOMPATIBLE BROWSERS function changeQuote() {...
2
by: MimiMi | last post by:
I'm completely new to xml-manipulation in C#. I have an XmlDocument (xmldoc) and want to add a new element (node) to the xmldoc.DocumentElement.ChildNodes. How do I achieve that? Thanks!
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.