473,770 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

47 New Member
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 7514
markmcgookin
648 Recognized Expert Contributor
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
Kapil Choubisa
47 New Member
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 Recognized Expert Contributor
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 Recognized Expert Contributor
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
Kapil Choubisa
47 New Member
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 Recognized Expert Contributor
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
1895
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 file to mobile from PHP.Is it possible to download a file to mobile similar to desktop(PC) - like displaying 'save as ' dialog box. I want to know commonly supported file format for all types of mobiles.Bcz i tried out by downloading...
0
3438
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 to a PDA/palmtop via POP3. The PDA uses Windows Mobile software. Since using the PDA, I have had the problem of emails disappearing from the Yahoo! server. However I think I now understand how to avoid this. It seems that Windows Mobile is...
4
26290
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 still images.
1
2870
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 control. Now on a similar device running window mobile 6.0 the file is not displayed - the link causes a post back succesfully and the code appears to execute - on the browser a bar is displayed breifely at the bottom of the window (although ist...
7
6384
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 C++.. Waiting for Reply ASAP...
9
3717
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 of the mobile IE, it pops up several JScript error and the ajax behavior is not funtional at all. Where can I look for any possible issue? Thanks.
2
3451
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 mobile? do i need to import that folder itself to mobile?? i heard about one .cab file... if thatz true, then can any one help me by suggesting some idea...
1
4195
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 below. Any help will be highly appriciable. Thanks. Mayank
0
2121
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 later. I understand that it can be done by using StgCreateDocFile API and IStorage to do this.But I don't find any information on how to implement this. I appreciate if you can provide steps or samples to implement CFS in windows mobile? Thanks
3
3082
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
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.