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