Re: [mono-android] Error while retreiving data from xml file

2013-02-23 Thread Mike Child
As mentioned previously, please provide the actual error message. It's hard
to help without knowing the problem.
On Feb 23, 2013 1:20 AM, "krish"  wrote:

> ha,i changed the code ...i closed the FileStream
> even though it is giving error at same line
>   xmldoc.Load(fs);
> here is my modified code:
> private void retrvXml()
> {
> string path =
>
> System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments),
> "Emp7.xml");
> //throw new NotImplementedException();
> XmlDataDocument xmldoc = new XmlDataDocument();
> XmlNodeList xmlnode;
> int i = 0;
> string str=null ;
>// XmlReader reader= XmlReader.Create(path);
> FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
> xmldoc.Load(fs);
> xmlnode = xmldoc.GetElementsByTagName("Item");
> for (i = 0; i <= xmlnode.Count - 1; i++)
> {
> xmlnode[i].ChildNodes.Item(0).InnerText.Trim();
> str = xmlnode[i].ChildNodes.Item(0).InnerText.Trim() + " | " +
> xmlnode[i].ChildNodes.Item(1).InnerText.Trim() + " | " +
> xmlnode[i].ChildNodes.Item(2).InnerText.Trim();
> text.Text = str;
> }
>fs.Close();   //here i closed the FileStream
>}
> here i closed the FileStream even though i m getting error...i also tried
> to
> put Closing FileStream in for loop like..
>
>
> for (i = 0; i <= xmlnode.Count - 1; i++)
> {
> xmlnode[i].ChildNodes.Item(0).InnerText.Trim();
> str = xmlnode[i].ChildNodes.Item(0).InnerText.Trim() + " | " +
> xmlnode[i].ChildNodes.Item(1).InnerText.Trim() + " | " +
> xmlnode[i].ChildNodes.Item(2).InnerText.Trim();
> text.Text = str;
> fs.Close();
> }
>
> even though i m  getting error at xmldoc.Load(fs);plz tell me the
> solution as early as possible...
>
>
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/Error-while-retreiving-data-from-xml-file-tp5712920p5712925.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] how to store data to xml file (like database) from mono for android

2013-02-23 Thread Craig Dunn
check out the *Android_Starter* solution in our *Getting Started* example

http://www.xamarin.com/getting-started/TaskyAndroid.zip

specifically, the C# in /Android_Starter/Tasky.Core/TaskRepository.cs shows
a list of C# classes being loaded and saved in an XML file using
serialization.

NOTE: the other Android solution in that ZIP uses SQLite database instead
of XML ~ be sure to open the correct code.

Hope that helps
Craig


On Fri, Feb 22, 2013 at 11:01 PM, krish  wrote:

>  hii wnt to use xml file as data storage...can any one tell me how to
> store data to xml file from mono for android edit texts i have 2 edit
> text controls when i click on save button the data in the edit text have to
> store into the xml file...m very new to mono for android...where to create
> xml file and where to write code...explain me in detailed step wise...its
> very need to me...
>
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid