Bug Tracker

Opened 14 years ago

Closed 13 years ago

#3943 closed bug (invalid)

Parsing xml from hiddenField

Reported by: Qusai Owned by:
Priority: major Milestone: 1.3
Component: unfiled Version: 1.3
Keywords: Cc:
Blocked by: Blocking:


Hi, First, Thanks for the help. I am storing xml in a hidden field which is going to be updated by some user actions. I need the xml changes to be reflected in an unsorted list so I am using jquery to do that. The code works in Firefox but not IE. Following is a sample of the code. Thanks for the help again.



<html> <head>

<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <title>Address book</title>

<script src="jquery-1.3.js" type="text/javascript"></script>

<script type="text/javascript">

function MyFunc() {

var xml = document.getElementById('myHiddenField').value; $(unescape(xml)).find('MediaAssetInfoLite').each(function() {

var title = $(this).find('Title').text(); var url = $(this).find('Uri').text(); $('<li></li>').html('<a href=\"' + url + '\">' + title + '</a>').appendTo('#target');




</head> <body>

<div id='update-target'>

<a href="javascript:MyFunc();">Click here to load addresses</a> <ul id="target"> </ul> <input id="myHiddenField" type="hidden" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?>

&lt;ArrayOfMediaAssetInfoLite xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; > &lt;MediaAssetInfoLite> &lt;Title>object13_t&lt;/Title> &lt;Uri>http://localhost/Assets/object13_t.jpg&lt;/Uri> &lt;/MediaAssetInfoLite> &lt;MediaAssetInfoLite> &lt;Title>pc0134a_collectItem&lt;/Title> &lt;Uri>http://localhost/Assets/pc0134a_collectItem.png&lt;/Uri> &lt;/MediaAssetInfoLite> &lt;MediaAssetInfoLite> &lt;Title>pc0134a_display&lt;/Title> &lt;Uri>http://localhost/Assets/pc0134a_display.png&lt;/Uri> &lt;/MediaAssetInfoLite> &lt;/ArrayOfMediaAssetInfoLite>"



</body> </html>

Change History (1)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

The $(html) operation can't be used to parse xml. Use an xml parser instead.

Note: See TracTickets for help on using tickets.