How To Read XML From Javascript In Xamarin Studio - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › How To Read XML From Javascript In Xamarin Studio (1224 Views)
1 Reply
| How To Read XML From Javascript In Xamarin Studio by Nobody: 4:37pm On Jul 10, 2015*. Modified: 5:01pm On Jul 10, 2015 |
Just wondering how I can read an XML file from JavaScript in Xamarin Studio like below: <script ttype="text/javascript"> xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET","books.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; txt=xmlDoc.getElementsByTagName("title" [0].childNodes[0].nodeValue;document.write(txt); </script> |
| Re: How To Read XML From Javascript In Xamarin Studio by Nobody: 8:33pm On Jul 30, 2015*. Modified: 11:21pm On Jul 30, 2015 |
I got the solution without using JavaScript. Here is the code for anyone who may need it public class MainActivity : Activity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); WebView webView = FindViewById<WebView>(Resource.Id.WebView); // Read the XML file placed in the Assets folder string XMLcontent = ""; string line; using (StreamReader sr = new StreamReader (Assets.Open ("note.xml" )){ while ((line = sr.ReadLine()) != null) { XMLcontent += line + "</br>"; } } webView.LoadData(XMLcontent, "text/html", "UTF-8" ;} } |
Javascript In Pidgin!!! • How It Feels Like To Learn Javascript In 2016 • Can I Learn Javascript In One Month • 2 • 3 • 4
How To Create The Googe Products Free • Big Data And Hadoop • <<<<<<<<<<<<<<<<<i Need A Professional To Build Me A Website. Add Me Asap>>>>>>
[0].childNodes[0].nodeValue;