"Original": how to read local XML files in the PPC Simulator

Source: Internet
Author: User

I recently used it in practice.PPCReadXMLThe document encountered a small problem, that isPPCOn the simulator, if you do not go through the following settings, you will not be able to access the local files correctly, always prompt errors, and write your experiences here so that you will not be troubled by this problem.

1,First, we prepareXMLFile, put it in "My documents", and then --> open the simulator --> --〉File--> --〉Configuration--> --〉Shared fold--> Select "My Documents"(You can click here).

After step 1, in the simulator, the shared folder becomes a memory card, that is, the address of this folder isStorage card.

2. Create a smart device project(Here I amWindows Mobile 6)The following interface is designed:

Then, dragOpenfiledialogControl, and double-clickOpenfileButton to enterCodeWrite.

1,The Code is as follows:

Private VoidMenuitem2_click (ObjectSender,EventargsE)

{

Openfiledialog1.showdialog ();

Try

{

StringFile = openfiledialog1.filename. tostring ();//Read XML documents from openfiledialog

StreamreaderSr =New Streamreader(File );

XmltextreaderXTR =New Xmltextreader(SR );

While(XTR. Read ())

{

Listbox1.items. Add ("Nodetype :"+ XTR. nodetype. tostring ());//It can be changed according to the actual situation to verify whether the data is read or not.

}

MessageBox. Show (File );

}

Catch(ExceptionEx)

{

MessageBox. Show (ex. tostring ());

}

}

The running image is as follows:

Open a file

My XML file is test1.xml, which appears after selection

The file path is also displayed."Storage card".

 

at this point, the local XML file is read.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.