₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,668 members, 8,513,053 topics. Date: Wednesday, 04 November 2026 at 11:52 AM

Toggle theme

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 (1235 Views)

1 Reply

How To Read XML From Javascript In Xamarin Studio by Nobody:
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:
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 Reply

Javascript In Pidgin!!! • How It Feels Like To Learn Javascript In 2016 • Can I Learn Javascript In One Month • 2 • 3 • 4

Masts At Banks What Are They Realky Used For? • Etisalat Simple Server Setting Pc • Contract Html/ui Developer