Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,190,610 members, 7,941,346 topics. Date: Friday, 06 September 2024 at 02:12 AM |
Nairaland Forum / Science/Technology / Programming / How To Read XML From Javascript In Xamarin Studio (1149 Views)
Javascript In Pidgin!!! / How It Feels Like To Learn Javascript In 2016 / Can I Learn Javascript In One Month (2) (3) (4)
(1) (Reply)
How To Read XML From Javascript In Xamarin Studio by Nobody: 4:37pm 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 |
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" } } 1 Like |
(1) (Reply)
Spectranet For Linux / Please Kindly Help With This JSON Code / Modify Default Page Template And Add 2 Sidebars In Wordpress
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7 |