₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,436 members, 8,421,999 topics. Date: Sunday, 07 June 2026 at 01:14 PM

Toggle theme

How To Read XML From Javascript In Xamarin Studio - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHow To Read XML From Javascript In Xamarin Studio (1224 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 2016Can I Learn Javascript In One Month234

How To Create The Googe Products FreeBig Data And Hadoop<<<<<<<<<<<<<<<<<i Need A Professional To Build Me A Website. Add Me Asap>>>>>>