How to load xml document? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to load xml document?

Hi everybody.

I'm using VS2005 C# to code a smart device project, which should run in Pocket PC 2003 SE emulator. When I try to load a xml document as in this sample

private void Display()
{
try
{
XmlDocument doc = new XmlDocument();
string url = @D:NewFolderNotebookNotebookXmldiary.xml;
doc.Load(url);
DateTime t = dateTimePicker1.Value;
string date = Convert.ToString(t.Day) + "/" + Convert.ToString(t.Month) + "/" + Convert.ToString(t.Year);
XmlNode node = doc.SelectSingleNode("diary[@date = " + date + "]");
textBox1.Text = node.Value;
}
catch (System.IO.FileNotFoundException e)
{
MessageBox.Show(e.Message);
}

A problem occurred like this :

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in System.Xml.dll

I presume that the emulator doesn't know the path (url) on PC, but I don't
know how to correct.

Can someone guide me how to correct this problem?
Thank you so much in advance.

Comments

  • Ptr_082004Ptr_082004 Posts: 31Member
    : Hi everybody.
    :
    : I'm using VS2005 C# to code a smart device project, which should run in Pocket PC 2003 SE emulator. When I try to load a xml document as in this sample
    :
    : private void Display()
    : {
    : try
    : {
    : XmlDocument doc = new XmlDocument();
    : string url = @D:NewFolderNotebookNotebookXmldiary.xml;
    : doc.Load(url);
    : DateTime t = dateTimePicker1.Value;
    : string date = Convert.ToString(t.Day) + "/" + Convert.ToString(t.Month) + "/" + Convert.ToString(t.Year);
    : XmlNode node = doc.SelectSingleNode("diary[@date = " + date + "]");
    : textBox1.Text = node.Value;
    : }
    : catch (System.IO.FileNotFoundException e)
    : {
    : MessageBox.Show(e.Message);
    : }
    :
    : A problem occurred like this :
    :
    : A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
    : A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
    : A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
    : A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in System.Xml.dll
    :
    : I presume that the emulator doesn't know the path (url) on PC, but I don't
    : know how to correct.
    :
    : Can someone guide me how to correct this problem?
    : Thank you so much in advance.
    :
    :


    If your emulator allows it, try mounting the folder that contains your XML doc as a flash memory device on the emulator and change the path to match it. I don't know if that would work for Pocket PC 2003 emulator, but it works on a WM 5 emulator
  • mufantasymufantasy Posts: 2Member
    : : Hi everybody.
    : :
    : : I'm using VS2005 C# to code a smart device project, which should run in Pocket PC 2003 SE emulator. When I try to load a xml document as in this sample
    : :
    : : private void Display()
    : : {
    : : try
    : : {
    : : XmlDocument doc = new XmlDocument();
    : : string url = @D:NewFolderNotebookNotebookXmldiary.xml;
    : : doc.Load(url);
    : : DateTime t = dateTimePicker1.Value;
    : : string date = Convert.ToString(t.Day) + "/" + Convert.ToString(t.Month) + "/" + Convert.ToString(t.Year);
    : : XmlNode node = doc.SelectSingleNode("diary[@date = " + date + "]");
    : : textBox1.Text = node.Value;
    : : }
    : : catch (System.IO.FileNotFoundException e)
    : : {
    : : MessageBox.Show(e.Message);
    : : }
    : :
    : : A problem occurred like this :
    : :
    : : A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
    : : A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
    : : A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
    : : A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in System.Xml.dll
    : :
    : : I presume that the emulator doesn't know the path (url) on PC, but I don't
    : : know how to correct.
    : :
    : : Can someone guide me how to correct this problem?
    : : Thank you so much in advance.
    : :
    : :
    :
    :
    : If your emulator allows it, try mounting the folder that contains your XML doc as a flash memory device on the emulator and change the path to match it. I don't know if that would work for Pocket PC 2003 emulator, but it works on a WM 5 emulator
    :
    Thank you. It works
Sign In or Register to comment.