Solved

xml data islands in FireFox

Posted on 2009-05-18
3
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

710 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