Side navigation
#3943 closed bug (invalid)
Opened January 21, 2009 09:08PM UTC
Closed October 14, 2009 02:00AM UTC
Parsing xml from hiddenField
Reported by: | Qusai | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | unfiled | Version: | 1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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.
<!DOCTYPE html PUBLIC "-W3C DTD HTML 4.01EN"
"http:www.w3.org/TR/html4/strict.dtd">
<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');
});
}
</script>
</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="<?xml version="1.0" encoding="utf-16"?>
<ArrayOfMediaAssetInfoLite xmlns:i="http://www.w3.org/2001/XMLSchema-instance" >
<MediaAssetInfoLite>
<Title>object13_t</Title>
<Uri>http://localhost/Assets/object13_t.jpg</Uri>
</MediaAssetInfoLite>
<MediaAssetInfoLite>
<Title>pc0134a_collectItem</Title>
<Uri>http://localhost/Assets/pc0134a_collectItem.png</Uri>
</MediaAssetInfoLite>
<MediaAssetInfoLite>
<Title>pc0134a_display</Title>
<Uri>http://localhost/Assets/pc0134a_display.png</Uri>
</MediaAssetInfoLite>
</ArrayOfMediaAssetInfoLite>"
/>
</div>
</body>
</html>
Attachments (0)
Change History (1)
Changed October 14, 2009 02:00AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
The $(html) operation can't be used to parse xml. Use an xml parser instead.