Hi,
with the next release of Ajax.NET Professional you will be able to
transform any XmlDocument or XmlNode into a JSON object. This is
really cool because we have already a lot of xml documents in our web
applications. Currently you have to write a custom class or struct
where you have to fill the properties or public fields. Now, you
simply call the JavaScriptUtil.GetIJavaScriptObjectFromXmlNode method
to return a JavaScript object. At
http://munich.schwarz-interactive.de/datatype.aspx I have added a new
test (Test 32) which will read the RSS from the Google group and
display the title and last 10 posts.
My C# server-side source code looks like this:
[AjaxPro.AjaxMethod]
public static AjaxPro.IJavaScriptObject Test31()
{
XmlDocument doc = new XmlDocument();
doc.Load("http://groups.google.de/group/ajaxpro/feed/rss_v2_0_msgs.xml");
return
AjaxPro.JavaScriptUtil.GetIJavaScriptObjectFromXmlNode(doc.DocumentElement);
}
The RSS xml document looks like this
(http://groups.google.de/group/ajaxpro/feed/rss_v2_0_msgs.xml):
<rss version="2.0">
<channel>
<title>Ajax.NET Professional Google Group</title>
<link>http://groups.google.com/group/ajaxpro</link>
<item>
<title>Re: [ajaxpro] Title of post</title>
// ...
</item>
<item>
// ...
</item>
</channel>
</rss>
Now, you are able to write JavaScript code like this:
<script type="text/javascript">
function callback(res) {
var chn = res.value.channel;
alert("The RSS channel title: " + chn.title + "\r\nLink: " + chn.link);
var h = [];
for(var i=0; i<chn.item.length; i++) {
h.push(chn.item[i].title + "\r\n");
}
alert(h.join(""));
}
</script>
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---