-1

I'm trying to load Raw XML from a file in my projects assets folder using Mono For Android.

When i press the button I get no errors so the file is clearly being found but the contents aren't loading into the text view. Am I missing something or is my code completely wrong?

Here is my code:

var xmlView = FindViewById<TextView> (Resource.Id.xmlView);

        Button button = FindViewById<Button> (Resource.Id.loadXml);



        button.Click += delegate(object sender, EventArgs e) {

            XmlDocument doc = new XmlDocument();

            Assets.Open ("XMLFile.xml");

            string xmlcontents = doc.InnerXml;



            xmlView.Text = "File Loaded!" + xmlcontents;

        };
4

1 回答 1

0

您没有加载文档。

        XmlDocument doc = new XmlDocument();
        doc.Load(<your doc path>);
于 2013-07-26T13:25:14.237 回答