Solved

xml data islands in FireFox

Posted on 2009-05-18
3
688 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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)
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

863 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