Solved

xml data islands in FireFox

Posted on 2009-05-18
3
687 Views
Last Modified: 2013-12-07
My web app uses XML data islands to hold data on the page that the underlying javascript will process later:

<xml id="myxml" name="myxml" runat="server"></xml>

Data consisting of well-formed xml is retrieved from the server when the page is loaded, and the javascript can get the xml by looking up the element (document.getElementById("myxml")) and using the innerHTML property, and then process it.

This works great in IE.

I have to make this work in Firefox.

Unfortunately, Firefox doesn't directly support the <xml> tag. So I wind up with two problems:

1) The xml gets spewed onto the screen. I can fix this by hiding the element.

2). The bigger problem is that the xml is being modified. The innerHTML property contains only the concatenated text of all the elements - all of the tags and attributes have been stripped out. This, of course, renders the text useless as xml.

I can work around this by using an <input type="hidden" ...> element instead of <xml>, but this requires lots of other code changes in the underlying c# and javascript that I am trying to avoid.

So the question is, how do I get the <xml> tag to behave in Firefox in a way that solves problem 2 listed above? Or is it not possible?

Is there a recommended method for doing xml data islands in Firefox?

Thanks!
0
Comment
Question by:wayside
  • 2
3 Comments
 
LVL 3

Expert Comment

by:Kelevra
ID: 24415417
Hi,
what if, you create a very small, <div> like 1px height and 1px width, and you store the xml in it.

This way you are able to work with it, and it wont bother you any more!.
hope this'll help
0
 
LVL 14

Author Comment

by:wayside
ID: 24416174
> what if, you create a very small, <div> like 1px height and 1px width, and you store the xml in it.

Doesn't seem to work. The innerHTML property of the element contains only the root element tag; all other tags and attributes have been stripped and only the text content is there.
0
 
LVL 14

Accepted Solution

by:
wayside earned 0 total points
ID: 24580891
The only workable solution I found was to use a hidden input control, and fix all of the underlying code.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Hovering effect 9 29
Javascript - output csv file 18 19
Bypass cross origin issues on development site 3 22
Video won't play 5 17
I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now