473,372 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

How can I get A XML file In Windows Mobile 6.o using C#?

I m new in developing windows mobile.
I am facing a problem to getting a xml file in code.

I have a XML file named trial.xml in the same folder where the application's executable exist.

Iused the following Code

Expand|Select|Wrap|Line Numbers
  1.  XmlDocument xd = new XmlDocument();
  2.             xd.Load("trial.xml");
It does not worked then I used

Expand|Select|Wrap|Line Numbers
  1. xd.Load("trial.xml");
  2. XmlTextReader reader = new XmlTextReader("trial.xml");
  3. XmlNodeList nodelst;
  4. nodelst = XmlDoc.GetElementsByTagName("detail");
It also not worked.
There is a error Occurs that directory or file not found.

Can anybody give me the solution of this Problem.


I hope you will help me.

Thanx in Advance
Sep 8 '09 #1
6 7502
markmcgookin
648 Expert 512MB
Hey, this is one of my favourite ways to rip through XML in c#

Expand|Select|Wrap|Line Numbers
  1. XmlDocument xmlFile = new XmlDocument();
  2.             xmlFile .Load(@"\My Documents\myXML.xml");
  3.             XmlNodeList nodeList = xmlFile.GetElementsByTagName("resources");
  4.             foreach (XmlElement elem in nodeList)
  5.             {
  6.                 foreach (XmlElement elem2 in elem.ChildNodes)
  7.                 {
  8.                   //.... do all your stuff here or loop more!
  9.  
Sep 8 '09 #2
Hi!, markmcgookin

I had tried your suggestion but I not works in Windows Mobile Application.
Can you give me this in Windows Mobile SDK6.0

Thanxxxx
Sep 9 '09 #3
markmcgookin
648 Expert 512MB
Kapil,

That was copied and pasted from a Windows Mobile 5/6 project.

What is the error/problem that you are getting?

Mark

EDIT: Oh I just saw in your original post that it can't find/access the file. Are you SURE that the file is in the local directory on the PDA? ... i.e. "Program Files/YourApplication/Trial.xml" You should check on the device to make sure that the file is there. Try manually copying the file into My Documents/Business on the PDA then change this line in the code I sent code

Expand|Select|Wrap|Line Numbers
  1. xmlFile .Load(@"\My Documents\Business\trial.xml");
  2.  
Sep 9 '09 #4
JamieHowarth0
533 Expert 512MB
This was taken from MSDN when I googled "c# mobile application path":

Expand|Select|Wrap|Line Numbers
  1. path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
  2.  
Then try:

Expand|Select|Wrap|Line Numbers
  1. xmlFile .Load(path + @"\trial.xml");
  2.  
Hope this helps.

codegecko
Sep 9 '09 #5
Thank You to all.
But I got the solution.
I had placed that file in my application's folder. So its not getting in Mobile emulator.

After all trying what ever you suggest me I place that file in SD Card and than Write the direct path I got the file.

Expand|Select|Wrap|Line Numbers
  1. XmlDocument Xdoc=new XmlDocument();
  2. Xdoc.Load("\\Storage Card\\trial.xml");
  3.  
It returns me the file.
But first I have to configure my emulators shared folder.
Sep 10 '09 #6
markmcgookin
648 Expert 512MB
Yeah, if you right click the file in VS2008 and make sure that in Build Options it is set to "Copy Always" over to the device
Sep 10 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: suresh_nsnguys | last post by:
Hi to all, I am new to this forum,I am new to this mobile technology.Right now i am creating one website using XHTML MP and PHP. I don't know how to download a binary...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
4
by: ink | last post by:
Hi All, I am trying to build an image capture user control using DirectShow to be used in an existing C# application. It needs to have a view finder/ preview window and be able to take...
1
by: =?Utf-8?B?V29vZGdub21l?= | last post by:
Hi, I have use the following code to transmit a file back to the browser that worked fine on a HTC_TTyN device running windows mobile 5.0. The code executes in the onclick event of a mobilelist...
7
by: JayaseelanVaiyapuri | last post by:
Hi all, I have done with Symbian and Blackberry for retrieving Mobile Country Code(MCC) from my mobile using my app.. Now i want to know how to get the MCC for Windows Mobile using Win32...
9
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi, I downloaded the sample application that the Microsoft video ASPNETAJAXForWinMobile described but it doesn't work on my Windows Mobile 6 emulator. After enabling the script error reporting...
2
by: libish | last post by:
i've developed an application for windows mobile... now i want to load it to windows mobile... here after i compiled the application, i got some .dll and one .exe file nw how will i load it to...
1
by: MayankSharma | last post by:
Hi I am new user in Windows Mobile development. I need help to make connectivity of pocket PC with Printer by blutooth and By USB by using C# coding. Please send any help to the mailID given...
0
by: Mona123 | last post by:
Hi, I want to create a Compound file system in which I can create files and folders and handle all the file notifications like file create, open,read,write,move,copy etc. in windows mobile 5.0 and...
3
by: kishorereddyambati | last post by:
How can I stream audio file from server and play in Windows Mobile using windows media player without downloading that file into mobile the mobile device?
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.