Solved

xml data islands in FireFox

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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…
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.

770 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