?
Solved

xml data islands in FireFox

Posted on 2009-05-18
3
Medium Priority
?
708 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

719 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