at the detailed requirements.2. The code implementation algorithm can be optimized.3.xml file structure can be optimized, this is the resources that iOS directly to me. But looked very without words, city.xml less, directly manually changed a bit, Area.xml file is more, there is no change.Suggestions:This blog is just to provide you with a realization of the ide
This article describes the XML file read and write methods of Android programming. Share to everyone for your reference. The specific analysis is as follows:
First, the environment:
Host: WIN8Development environment: Eclipse
Second, note:
1. Open the XML
In Qt, we sometimes need to write some parameters to the XML file, so that we can read it later, like an archive read operation, for example, we want to generate the following XML file:XML version= "1.0" encoding= "UTF-8"?>Parameters> para1>1para1> Para2>2Para2> Par
namespaceW_r_xml_model2 {3 //Mark First, then public4 [Serializable]5 Public classOneperson6 {7 Public stringName {Get;Set; }8 Public intAge {Get;Set; }9 Public CharGender {Get;Set; }Ten } One class Program A { - Static voidMain (string[] args) - { thelistNewlist - { - NewOneperson {Name ="Rico", age = -, Gender ='male'},//object initializers can be omitted () - NewOneperson {Name ="X
; }/** * Second, get the file from the Raw folder in resource and read the data (resource file can only read and write) * * @param fileinraw * @return */Public S Tring Readfromraw (int fileinraw) {String res = ""; try {InputStream in = Getresources (). Openrawresource (Fileinraw); int le
Read the configuration parameters in the xml file and the parameters in the xml file.
Paras. xml file
SysParam. java files
Package com. wisoft. tysfrz. utils;/*** system configuration
How to read XML from a file
This example illustrates how to use the xmltextreader class to read XML from a file. This class provides direct analysis and tagging of XML, and implements
In Android, the pull parser is used to generate XML files and read XML files.
In Android, the Pull parser 1 is used, and the running mode of the Pull parser is similar to that of the SAX Parser. It provides similar events, such as the start element and end element events. 2
C # Writing XML read-write class operation XML file
The following example uses C # to implement XML operations in ASP. VS2005, writes an operation class, and then calls it when it is used.Implementation: Login user information to add, modify and delete, do not use the databa
: the entire document tree is in the memory for easy operation. It supports deletion, modification, and re-arrangement among other functions.
Disadvantage: transferring the entire document to memory (often containing a large number of useless nodes) wastes time and space.
Usage: Once the file is parsed, you need to access the data multiple times and have sufficient resources (such as memory and CPU ).
To solve these problems caused by Dom parsing
The 1,pull parser, which uses the pull parser under Android, works like a sax parser. It provides similar events, such as: start element and end element event. 2, use Parser.next () to enter the next element and trigger the corresponding event. 3, the event is sent as an int value, so a switch can be used to process the corresponding event. 4, when the element begins parsing, call the Parser.nexttext () method to get the value of the next text type no
Android uses the pull parser to generate XML files and read XML files. androidpull
In Android, the Pull parser 1 is used, and the running mode of the Pull parser is similar to that of the SAX Parser. It provides similar events, such as the start element and end element even
easy operation. It supports deletion, modification, and re-arrangement among other functions.
Disadvantage: transferring the entire document to memory (often containing a large number of useless nodes) wastes time and space.
Usage: Once the file is parsed, you need to access the data multiple times and have sufficient resources (such as memory and CPU ).
To solve these problems caused by Dom parsing XML
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.