Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,502 members, 7,781,528 topics. Date: Friday, 29 March 2024 at 04:17 PM

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 (1132 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"wink[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"wink))
{
while ((line = sr.ReadLine()) != null)
{
XMLcontent += line + "</br>";
}

}

webView.LoadData(XMLcontent, "text/html", "UTF-8"wink;
}
}

1 Like

(1) (Reply)

Money Generator Software,real And Tested / Please Help ! Help!! Help!!! / Php Experts, Really Need Your Help

(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. 5
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.