CN103577599A - Method and device for storing local data through mobile terminal - Google Patents
Method and device for storing local data through mobile terminal Download PDFInfo
- Publication number
- CN103577599A CN103577599A CN201310576688.3A CN201310576688A CN103577599A CN 103577599 A CN103577599 A CN 103577599A CN 201310576688 A CN201310576688 A CN 201310576688A CN 103577599 A CN103577599 A CN 103577599A
- Authority
- CN
- China
- Prior art keywords
- data
- xml
- module
- local
- converted
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Transfer Between Computers (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a method for storing local data through a mobile terminal. The method includes the steps that the mobile terminal calls a Web Service interface through the AJAX to have access to a Web server, or FTP downloading is achieved through a JavaScript interface, or data are obtained through physical external input; the format of the data is detected, the format of the data is determined and converted into the XML format, the XML data are analyzed, the XML data are converted into an JavaScript object, the JavaScript object is converted into JSON data through the function call method, and the JSON data are stored. The invention further discloses a device for storing the local data through the mobile terminal at the same time. By means of the scheme, local storage of data from different sources is achieved, maintainability of the mobile terminal is improved, and user experience is improved.
Description
Technical field
The present invention relates to data storage technology, be specifically related to a kind of local datastore method and device of mobile terminal.
Background technology
Mobile terminal product, as mobile phone, smart mobile phone, panel computer etc. have just obtained users' welcome since coming out.Along with reaching its maturity of the technology such as cyber-net communication, the mobile terminal device of new generation that smart mobile phone, panel computer and Related product be representative of take becomes rapidly this field digitizing, networking and intelligentized developing direction.A new generation's mobile terminal is not standby, as smart mobile phone includes a large amount of application functions, must occur the problem to the storage of various application datas and processing.Famous data base management system (DBMS) has MySQL, Oracle etc., and they are applicable to the storage of the mass data in general-purpose computing system.But for the limited handhold mobile terminal equipment of the software and hardware resources such as storage space, they can not install huge database.In this case, how reasonably tissue, Storage and Processing data just seem especially important.
The storage of intelligent mobile terminal, the data storage while being divided into persistent data storage and operation, the former still exists data after closing application program, and the latter just exists when program is moved.Again more specifically, the former still exists explanation data to be stored on equipment with specific form after closing application program.The latter exists when program is moved, and explanation is that data are stored in internal memory, Memory recycle after closing application program, and data have also just been destroyed.Can find out, a persistent data storage just must be stored on equipment with certain form.At present, the storage about perdurable data does not also have cross-platform solution.
Summary of the invention
In view of this, the fundamental purpose of the embodiment of the present invention is to provide a kind of local datastore method and device of mobile terminal, can realize this locality storage of the data of separate sources, improves the maintainability of mobile terminal, promotes user's experience.
For achieving the above object, the technical scheme of the embodiment of the present invention is achieved in that
The embodiment of the present invention provides a kind of local datastore method of mobile terminal, and described method comprises:
Mobile terminal is by AJAX invoking web page service (Web Service) interface accessing Web server, or, by the file transfer protocol (FTP) (FTP, File Transfer Protocol) of JavaScript Interface realization, download, or, by the outside input of physics, obtain data;
Detect the form of described data, the form of determining described data is extend markup language (XML, Extensible Markup Language) during form, analyzing XML data, described XML data are converted to JavaScript object, by function calling method, described JavaScript object is converted to JavaScript object encoding method (JSON, JavaScript Object Notation) data, and stores described JSON data.
In such scheme, describedly by AJAX, call Web Service interface accessing Web server and obtain data and comprise:
The web service descriptive language providing according to Web Service interface (WSDL, Web Services Description Language) document generates Simple Object Access Protocol (SOAP, Simple Object Access Protocol) request message;
Create AJAX call back function;
By XMLHttpRequest, send the AJAX that carries SOAP request message and ask to Web server, when described AJAX asks successfully, receive Web server and return to SOAP response message, resolve described SOAP response message, obtain XML data.
In such scheme, described analyzing XML data, are converted to JavaScript object by described XML data and comprise:
Read XML data, described XML data are converted to XML character string;
Create document dbject model (DOM, Document Object Model) resolver, load described XML character string, by the parseFromString method of described DOM resolver, resolve described XML character string, described XML character string is converted to JavaScript object.
In such scheme, described method also comprises:
When the data of determining storage need to be upgraded, read and need the JSON data upgraded, described JSON data are converted to XML data, by described XML data upload to server.
In such scheme, JSON data are stored up by local embedded database described in mobile terminal stores;
Mobile terminal, according to described local embedded database sign, detects described local embedded database by openDatabase method, when described local embedded database being detected, returns to the Database object of described database; When described local embedded database not detected, create new local embedded database, and return to the Database object of described local embedded database.
In such scheme, described method also comprises: by title name, version version, display Name display_name and the big or small size of the described local embedded database of window.openDatabase method definition.
In such scheme, described method also comprises: the transaction method that mobile terminal provides by described local embedded database, and with increase, deletion, modification and the query manipulation of database things mode executing data.
The embodiment of the present invention also provides a kind of local data storage of mobile terminal, and described device comprises: acquisition module, detection module, data conversion module and memory module; Wherein,
Described acquisition module, for call Web Service interface accessing Web server by AJAX, or the FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data, described data are sent to detection module;
Described detection module, the form of the data that send for detection of described acquisition module, when described data layout is XML form, sends to data conversion module by XML data;
Described data conversion module, the XML data that send for resolving described detection module, described XML data are converted to JSON object, by function calling method, described JavaScript object is converted to JavaScript object encoding method JSON data, and described JSON data are sent to memory module;
Described memory module, the JSON data that send for storing described data conversion module.
In such scheme, described acquisition module, obtains data and specifically comprises by calling Web Service interface accessing Web server:
The web service descriptive language WSDL document providing according to Web Service interface generates simple object access protocol request message;
Create AJAX call back function;
By XMLHttpRequest, send the AJAX that carries SOAP request message and ask to Web server, when described AJAX asks successfully, receive Web server and return to SOAP response message, resolve described SOAP response message, obtain XML data.
In such scheme, described data conversion module also comprises: parsing module and modular converter; Wherein,
Described parsing module, be used for creating DOM resolver, load the XML character string that described modular converter sends, by parseFromString method, resolve described XML character string, described XML character string is converted to JavaScript object, described JavaScript object is sent to described modular converter;
Described modular converter, for XML data are converted to XML character string, sends to parsing module by described XML character string; Also for described JavaScript object being converted to JSON data by function call mode.
In such scheme, described device also comprises determination module, read module and data operation modules; Wherein,
Described determination module, in the time of need to upgrading for the data of definite described memory module, notice read module;
Described read module, for reading the JSON data that need renewal, sends to data conversion module by described JSON data;
Accordingly, described data conversion module, the JSON data that also described read module sent are converted to XML data, and described XML data are sent to data operation modules;
Described data operation modules, for XML data upload that described data conversion module is sent to server.
In such scheme, described memory module is stored described JSON data and is stored up by local embedded database;
Described data operation modules, the transaction method for providing by described local embedded database also, with increase, deletion, modification and the query manipulation of database things mode executing data.
Local datastore method and the device of a kind of mobile terminal provided by the invention, mobile terminal calls Web Service interface accessing Web server by AJAX, or the FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data; Detect the form of described data, the form of determining described data is XML form, and analyzing XML data are converted to JavaScript object by described XML data, and by function calling method, described JavaScript object is converted to JSON data, and store described JSON data; So, realize this locality storage of the data of separate sources, improved the maintainability of mobile terminal, promoted user's experience.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the local datastore method of embodiment of the present invention mobile terminal;
Fig. 2 is that embodiment of the present invention mobile terminal calls by AJAX the method flow schematic diagram that Web Service interface accessing Web server obtains data;
Fig. 3 is the composition structural representation of the local data storage of embodiment of the present invention mobile terminal;
Fig. 4 is the schematic flow sheet of local datastore method of the mobile terminal of further embodiment of this invention.
Embodiment
Technical scheme provided by the invention mainly solves this locality storage of the data of XML form, the cross-platform framework of mobile application by Web technology is realized, the cross-platform framework of described mobile application is that the built-in browser engine of take on mobile-terminal platform to be provided is core, by built-in browser engine is customized, realized the 5th edition (HTML5 of HTML (Hypertext Markup Language), Hypertext Markup Language5rd), the support of the technology such as Cascading Style Sheet (CSS, Cascading Style Sheet), JavaScript.
The cross-platform framework of described mobile application provides unified access interface layer, and to shield the difference of each platform interface, described unified access interface layer is JavaScript form, realizes the conversion of calling between JavaScript interface and local interface.Specifically comprise: by AJAX, call Web Service interface accessing Web server or the FTP by JavaScript Interface realization downloads or obtain data by modes such as the outside inputs of physics, detect the form of described data, the form of determining described data is XML form, the data of parsing XML format, the data of described XML form are converted to the data of JSON form, the data of described JSON form are kept to local data base.
The cross-platform framework of mobile application described in the embodiment of the present invention carries out bottom adaptation based on specific mobile-terminal platform.For Android (Android) platform, use Java language to carry out adaptation; For Mobile operating system (iOS, the iphone Operation System) platform of Apple, use Objective-C language to carry out adaptation; And the cross-platform framework of described mobile application adopts dynamic extendible design, i.e. dongle configuration design, makes it have extensibility, thereby makes developer to framework, expand according to demand and revise.
Below in conjunction with drawings and the specific embodiments, the present invention is further described in more detail.
Fig. 1 is the schematic flow sheet of the local datastore method of embodiment of the present invention mobile terminal, and as shown in Figure 1, the method comprises the following steps:
Step 101: by AJAX, call Web Service interface accessing Web server, or the FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data.
Fig. 2 is that embodiment of the present invention mobile terminal calls by AJAX the method flow schematic diagram that Web Service interface accessing Web server obtains data; As shown in Figure 2:
Step 201: the WSDL document providing according to Web Service interface generates SOAP request message.
Here, described WSDL document is provided by Web Service interface, and mobile terminal can obtain NameSpace by analyzing described WSDL document, want the Information generation SOAP request messages such as access method title, method parameter.
Step 202: create AJAX call back function.
Here, described AJAX call back function comprises: an AJAX call back function that calls successful AJAX call back function and a malloc failure malloc; Describedly call successful AJAX call back function for successfully returning to afterwards SOAP response message calling; The AJAX call back function of described malloc failure malloc for returning to failed message after malloc failure malloc.
Here, Web server receives after described SOAP request message, and accessing database obtains the required related data of described mobile terminal, and returns to mobile terminal with the form of SOAP response message; Mobile terminal, after receiving described SOAP response message, is carried out call back function, resolves described SOAP response message, obtains data.
Further, the FTP by JavaScript Interface realization uploads/downloads that to obtain data be mainly the JavaScript Interface realization that the cross-platform framework of mobile application based on Web technology by middleware layer provides.Upload/download interface of FTP is provided by JavaScript object FtpClient.After initialization definitions object, this JavaScript object exposes put and two interfaces of get to application program, is respectively used to the upload and download of file.
Step 102~step 103: the form that detects described data, the form of determining described data is XML form, analyzing XML data, are converted to JavaScript object by described XML data, by function calling method, described JavaScript object are converted to JSON data.
Here, the data of described parsing XML format, are converted to JavaScript object by described XML data, comprising:
Read XML data, described XML data are converted to XML character string;
Create DOM resolver, load described XML character string, by the parseFromString method of described DOM resolver, resolve described XML character string, described XML character string is converted to JavaScript object;
By function call mode, described JavaScript object is converted to JSON data.
Concrete, described analyzing XML data, specifically comprise the following steps:
By window.requestFileSystem method, read the root file system of mobile terminal, if read successfully, obtain root directory object; The getFile method of using root directory object to provide, search the file that will read, search the FileEntry object of representation file, if search successfully, create File object and the FileReader object of an include file attribute, the readAsText method of using FileReader object to provide reads described XML file; After read requests completes, use the onloadend callback method of FileReader object, in method, reading result is operated, complete the read operation of XML data, the form by XML data with XML character string is stored in internal memory;
Create DOM resolver DOMParser, load XML character string, by parseFromString method, resolve described XML character string, described XML character string is converted to the XML DOM object that JavaScript can access, the method providing by DOM resolver is (as getElementsByTagName (name), childNodes[0]) each child node of XML DOM object is traveled through to retrieval, thereby complete the parsing to XML data, finally return and resolve resulting XMLDOM object.
Here, described described XML data are converted to JavaScript object, more described JavaScript object is converted to JSON data, specific implementation comprises the following steps:
Definition JavaScript object, is assigned to JavaScript object by the nodename of XML data recording, and each attribute that adds record is to corresponding JavaScript node object, completes described XML data are converted to JavaScript object;
Described JavaScript object just can be converted to JSON data by described JavaScript object by function calling method (toJSON) mode, specifically can realize by $ .toJSON (dataObj).
Here, the present invention uses JSON form as the form of data storage, is that JSON form, as a subset of JavaScript programming language, in the application based on Web technology, is used convenient because JSON form is compared with XML form.Therefore, the present invention adopts JSON form as the form of data storage.
Step 104: store described JSON data.
In the present embodiment, JSON data are stored up by local embedded database described in mobile terminal stores; Described local embedded database can be realized the increase of data in database, deletion, modification, query manipulation by World Wide Web Consortium W3C Standard Interface.
Concrete, mobile terminal, according to described local embedded database sign, detects described local embedded database by openDatabase method, when described local embedded database being detected, returns to the Database object of described database; When described local embedded database not detected, create new local embedded database, and return to the Database object of described local embedded database.
By the Database object of the described local embedded database of window.openDatabase method definition, described Database object definition the size (size) of the title of database (name), version (version), display Name (display_name) and database;
Specifically be defined as: window.openDatabase (name, version, display_name, size).
Further, the transaction method that mobile terminal provides by described local embedded database, with increase, deletion, modification and the query manipulation of database things mode executing data.Described transaction method is defined as follows: db.transaction(populateDB, error, success).The method is for passing through performing database affairs populateDB, database is operated, if affairs carry out unsuccessfully, the call back function error when carrying out affairs and carrying out unsuccessfully, if affairs run succeeded, the call back function success when carrying out affairs and running succeeded;
Concrete implementation method is as follows:
Wherein, to can transmitting in execulteSql () function of the increase of data, deletion, modification and query manipulation, corresponding Sql statement is as follows:
Increase statement: Insert into tablename[(field 1, field 2 ... .)] values (be worth 1, be worth 2 ... ..);
Delete: delete from table_name where conditional statement;
Modification Update table_name set field name=be newly worth;
Inquiry: select*from table_name;
Here, because Embedded SQL ite database self is short and small, interface is many, easily transplant, source code is readable and the advantage such as free, the present invention adopts SQLite database to carry out the storage of local data.
Further, described method also comprises: when the data of determining storage need to be upgraded, read and need the JSON data upgraded, described JSON data are converted to XML data, by described XML data upload to server.
Concrete, first needing JSON Data Format Transform is JavaScript object, can use evalJSON method $ .evalJSON (data) to realize; By JavaScript Object Creation DOMDocument object, described DOM Document object is XML data, the load method of calling described DOMDocument object loads a local file, if file does not exist in loading procedure, create a new file, structure document content character string, after construction complete, call loadXML method and load XML data, finally call save method and write XML data.
Here, whether the data that change in specified data storehouse need is uploaded, and can, according to specific sight, by detecting, the outside input of mobile terminal be triggered and be uploaded, for the data source information of update server.
Concrete, mobile terminal XML data upload, to far-end server, is mainly the JavaScript Interface realization that the cross-platform framework of application provides that moves based on Web technology by middleware layer.FTP uploads interface and is provided by JavaScript object FtpClient.After initialization definitions object, this object exposes put interface to application program, for uploading of file.
For example, the operator's base station generaI investigation of take is scene, when user clicks " census data is uploaded button " of mobile terminal, carry out the upload operation of change data, by obtaining mode of operation in mobile terminal data storehouse for data newly-increased, that revise and delete, described data are write by certain format in the temporary folder of establishment, obtain ftp server address, create and being connected of ftp server, by the data upload in described temporary folder to ftp server.
For realizing said method, the embodiment of the present invention also provides a kind of local data storage of mobile terminal, and as shown in Fig. 3 is, described local data storage comprises: acquisition module 31, detection module 32, data conversion module 33 and memory module 34; Wherein,
Described acquisition module 31, for call Web Service interface accessing Web server by AJAX, or the FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data, described data are sent to detection module 32;
Described detection module 32, the data layout sending for detection of described acquisition module 31, when described data layout is XML form, sends to data conversion module 33 by described XML data;
Described data conversion module 33, the XML data that send for resolving described detection module 32, described XML data are converted to JSON object, by function calling method, described JavaScript object is converted to JavaScript object encoding method JSON data, and sends to memory module 34 to preserve described JSON data;
Described memory module 34, the JSON data that send for storing described data conversion module.
Further, described memory module 34 adopts local embedded database to store up described JSON data, described database is realized the increase of data in database, deletion, modification, query manipulation by World Wide Web Consortium (W3C, World Wide Web Consortium) Standard Interface.
Further, described acquisition module 31, obtains data and specifically comprises by calling Web Service interface accessing Web server: the web service descriptive language WSDL document providing according to Web Service interface generates simple object access protocol request message; Create AJAX call back function; By XMLHttpRequest, send the AJAX that carries SOAP request message and ask to Web server, when described AJAX asks successfully, receive Web server and return to SOAP response message, resolve described SOAP response message, obtain XML data.
Further, described device also comprises determination module 35, read module 36 and data operation modules 37; Wherein,
Described determination module 35, in the time of need to upgrading for the data of definite described memory module 34, notice read module 36;
Described read module 36, for reading the JSON data that need change, sends to data conversion module 33 by described JSON data;
Accordingly, described data conversion module 33, the JSON data that also described read module 36 sent are converted to XML data, and described XML data are sent to data operation modules 37;
Described data operation modules 37, for XML data upload that described data conversion module 33 is sent to server.
Further, described data conversion module also comprises: parsing module and modular converter; Wherein,
Described parsing module, be used for creating DOM resolver, load the XML character string that described modular converter sends, by parseFromString method, resolve described XML character string, described XML character string is converted to JavaScript object, described JavaScript object is sent to described modular converter;
Described modular converter, for XML data are converted to XML character string, sends to parsing module by described XML character string; Also for described JavaScript object being converted to JSON data by function call mode.
Those skilled in the art are to be understood that, the function of each processing module in the local data storage of the mobile terminal of the embodiment of the present invention, can be with reference to the associated description of the local datastore method of aforementioned mobile terminal and understand, each processing module in the local data storage of the mobile terminal of the embodiment of the present invention, can realize by realizing the mimic channel of the function described in the embodiment of the present invention, the operation of software that also can be by carrying out the function described in the embodiment of the present invention on intelligent terminal realizes.
In several embodiment provided by the present invention, should be understood that disclosed method and apparatus can be realized by another way.Device embodiment described above is only schematic, for example, the division of described module, be only that a kind of logic function is divided, during actual realization, can there is other dividing mode, as: a plurality of modules or assembly can be in conjunction with, maybe can be integrated into another system, or some features can ignore, or do not carry out.In addition, coupling each other of each shown or discussed ingredient or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of equipment or module or communication connection can be electrical, machinery or other form.
The above-mentioned module as separating component explanation can or can not be also physically to separate, and the parts that show as module can be or can not be also physical modules, can be positioned at a place, also can be distributed on a plurality of mixed-media network modules mixed-medias; Can select according to the actual needs part or all of module wherein to realize the object of the present embodiment scheme.
In addition, each functional module in various embodiments of the present invention can all be integrated in a processing module, can be also each module respectively separately as a module, also can two or more module integrations in a module; Above-mentioned integrated module both can adopt the form of hardware to realize, and the form that also can adopt hardware to add software function module realizes.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can complete by the relevant hardware of service order, aforesaid business can be stored in a computer read/write memory medium, this business, when carrying out, is carried out the step that comprises said method embodiment; And aforesaid storage medium comprises: the various media that can storage service code such as movable storage device, ROM (read-only memory) (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD
Or, if the above-mentioned integrated module of the embodiment of the present invention usings that the form of software function module realizes and during as production marketing independently or use, also can be stored in a computer read/write memory medium.Understanding based on such, the part that the technical scheme of the embodiment of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in a storage medium, comprises that some instructions are used so that method is all or part of described in each embodiment of a computer equipment (can be personal computer, server or the network equipment etc.) execution the present invention.And aforesaid storage medium comprises: the various media that can storage service code such as movable storage device, ROM (read-only memory) (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD.
Fig. 4 is the schematic flow sheet of local datastore method of the mobile terminal of further embodiment of this invention, and the present embodiment obtains and storage means for the associated data files based on appointed task and data structure file; As shown in Figure 4, comprise the following steps:
Step 401: the data download operation that mobile terminal identification user triggers, creates SOAP request message.
Here, when the selected a certain task of user, while triggering fileinfo download event, mobile terminal is identified this down operation, and the WSDL document providing according to corresponding Web Service interface generates SOAP request message.
Step 402: send by AJAX HTML (Hypertext Markup Language) (HTTP, the HyperText Transfer Protocol) Asynchronous Request that is loaded with SOAP request message and, to Web server, call and obtain mission data file list interface getFileByTaskId.
Here, Web server is after receiving SOAP request message, and accessing database, and according to the task ID parameter in described SOAP request message, obtain the associated documents information of task, crosses SOAP response message by described associated documents information exchange and return to mobile terminal.
Step 403~step 404: the SOAP response message of the task that the is loaded with relevant information that reception Web server returns; Resolve described SOAP response message, obtain the data message relevant to task, and described data message is kept in database;
Step 405: mobile terminal be take task ID as querying condition, accessing database, the data message relevant to described task ID of inquiry storage.
Step 406: obtain after Query Result, resolve described data message, and show the data message relevant to described task ID with tabular form.
Step 407: the down operation of at least one data message that mobile terminal identification user triggers, creates SOAP request message.
Here, user's at least one data message in can click data information list, the operation that mobile terminal can be identified user triggers the down operation of described at least one data message.
Step 408: by AJAX send be loaded with SOAP request message HTTP Asynchronous Request to Web server, call and obtain ftp server address interface getFtpserverParam.
Step 409: receive the SOAP response message that Web server returns, resolve described SOAP response message, obtain ftp server address.
Step 410: according to described ftp server address, create and be connected with ftp server, obtain selected data message to local assigned catalogue from assigned catalogue.
Step 411: first resolve the data structure file in described data message, then resolve the data file in described data message, by the Data Analysis in described data message write into Databasce.
Step 412: while being parsed, in the list of renewal data message, the parsing of downloading data information identifies, and after all data messages are parsed, reminder-data information has been downloaded.
Below, when user changes data message, when the data of storage need to be upgraded, the present invention will be further described in detail in conjunction with specific embodiments.
Step 1: when user clicks " census data is uploaded " button of mobile mobile terminal, the upload operation of execute exception data, and on mobile terminal, create temporary file.
The present embodiment be take the generaI investigation of operator base station and is specifically described as scene.
Step 2: after document creation, accessing database, obtaining mode of operation in database is " increasing newly ", " modification " or " deletion ", and generaI investigation state is the data of " generally investigating ";
Step 3: obtain after Query Result, obtain and resolution data, data are written in created temporary file according to certain format.
Step 4: after file write operation, detect mobile client and whether store FTP address information; If nothing, creates SOAP request message.
Step 5: after SOAP request message creates, the HTTP Asynchronous Request that use AJAX transmission is loaded with soap message is to Web server, and ftp server address interface getFtpserverParam is obtained in access, obtains ftp server address, and returns to SOAP response.
Step 6: mobile terminal, after receiving SOAP response, is resolved soap message, obtains ftp server address; And ftp server address is stored in the internal memory of described mobile terminal.
Step 7: according to obtained ftp server address, establishment is connected with ftp server.
Step 8: generated abnormal data file is uploaded under the assigned catalogue of ftp server;
Step 9: upload after abnormal data file operation runs succeeded, create SOAP request message, call notification is resolved warehousing interface parseXmltoDB, and personnel are by the data loading in file for notice back-stage management, and return to soap message.
Step 10: mobile client is received after SOAP response, upgrades the state of uploading of uploading data, and while deletion action state is newly-built data.
Step 11: upgrade after uploading data has operated prompting user upload file success.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.
Claims (12)
1. a local datastore method for mobile terminal, is characterized in that, described method comprises:
Mobile terminal is by AJAX invoking web page service Web Service interface accessing Web server, or the file transfer protocol (FTP) FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data;
Detect the form of described data, when the form of determining described data is expandable mark language XML form, analyzing XML data, described XML data are converted to JavaScript object, by function calling method, described JavaScript object is converted to JavaScript object encoding method JSON data, and stores described JSON data.
2. local datastore method according to claim 1, is characterized in that, describedly by AJAX, calls Web Service interface accessing Web server and obtains data and comprise:
The web service descriptive language WSDL document providing according to Web Service interface generates simple object access protocol request message;
Create AJAX call back function;
By XMLHttpRequest, send the AJAX that carries SOAP request message and ask to Web server, when described AJAX asks successfully, receive Web server and return to SOAP response message, resolve described SOAP response message, obtain XML data.
3. local datastore method according to claim 1, is characterized in that, described analyzing XML data are converted to JavaScript object by described XML data and comprise:
Read XML data, described XML data are converted to XML character string;
Create document dbject model DOM resolver, load described XML character string, by the parseFromString method of described DOM resolver, resolve described XML character string, described XML character string is converted to JavaScript object.
4. local datastore method according to claim 1, is characterized in that, described method also comprises:
When the data of determining storage need to be upgraded, read and need the JSON data upgraded, described JSON data are converted to XML data, by described XML data upload to server.
5. local datastore method according to claim 1, is characterized in that, JSON data are stored up by local embedded database described in mobile terminal stores;
Mobile terminal, according to described local embedded database sign, detects described local embedded database by openDatabase method, when described local embedded database being detected, returns to the Database object of described database; When described local embedded database not detected, create new local embedded database, and return to the Database object of described local embedded database.
6. local datastore method according to claim 5, it is characterized in that, described method also comprises: by title name, version version, display Name display_name and the big or small size of the described local embedded database of window.openDatabase method definition.
7. local datastore method according to claim 1, it is characterized in that, described method also comprises: the transaction method that mobile terminal provides by described local embedded database, and with increase, deletion, modification and the query manipulation of database things mode executing data.
8. a local data storage for mobile terminal, is characterized in that, described device comprises: acquisition module, detection module, data conversion module and memory module; Wherein,
Described acquisition module, for call Web Service interface accessing Web server by AJAX, or the FTP by JavaScript Interface realization downloads, or, by the outside input of physics, obtain data, described data are sent to detection module;
Described detection module, the form of the data that send for detection of described acquisition module, when described data layout is XML form, sends to data conversion module by XML data;
Described data conversion module, the XML data that send for resolving described detection module, described XML data are converted to JSON object, by function calling method, described JavaScript object is converted to JavaScript object encoding method JSON data, and described JSON data are sent to memory module;
Described memory module, the JSON data that send for storing described data conversion module.
9. local data storage according to claim 8, is characterized in that, described acquisition module obtains data and specifically comprises by calling Web Service interface accessing Web server:
The web service descriptive language WSDL document providing according to Web Service interface generates simple object access protocol request message;
Create AJAX call back function;
By XMLHttpRequest, send the AJAX that carries SOAP request message and ask to Web server, when described AJAX asks successfully, receive Web server and return to SOAP response message, resolve described SOAP response message, obtain XML data.
10. local data storage according to claim 8, is characterized in that, described data conversion module also comprises: parsing module and modular converter; Wherein,
Described parsing module, be used for creating DOM resolver, load the XML character string that described modular converter sends, by parseFromString method, resolve described XML character string, described XML character string is converted to JavaScript object, described JavaScript object is sent to described modular converter;
Described modular converter, for XML data are converted to XML character string, sends to parsing module by described XML character string; Also for described JavaScript object being converted to JSON data by function call mode.
11. local data storage according to claim 8, is characterized in that, described device also comprises determination module, read module and data operation modules; Wherein,
Described determination module, in the time of need to upgrading for the data of definite described memory module, notice read module;
Described read module, for reading the JSON data that need renewal, sends to data conversion module by described JSON data;
Accordingly, described data conversion module, the JSON data that also described read module sent are converted to XML data, and described XML data are sent to data operation modules;
Described data operation modules, for XML data upload that described data conversion module is sent to server.
12. local data storage according to claim 8, is characterized in that, described memory module is stored described JSON data and stored up by local embedded database;
Described data operation modules, the transaction method for providing by described local embedded database also, with increase, deletion, modification and the query manipulation of database things mode executing data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310576688.3A CN103577599A (en) | 2013-11-15 | 2013-11-15 | Method and device for storing local data through mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310576688.3A CN103577599A (en) | 2013-11-15 | 2013-11-15 | Method and device for storing local data through mobile terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103577599A true CN103577599A (en) | 2014-02-12 |
Family
ID=50049375
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310576688.3A Pending CN103577599A (en) | 2013-11-15 | 2013-11-15 | Method and device for storing local data through mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103577599A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104376056A (en) * | 2014-11-04 | 2015-02-25 | 广州华多网络科技有限公司 | Data processing method and device |
CN104580417A (en) * | 2014-12-25 | 2015-04-29 | 中建材国际贸易有限公司 | Method for learning SCORM (sharable content object reference model) courseware on intelligent mobile terminal and intelligent mobile terminal |
CN104933487A (en) * | 2015-06-26 | 2015-09-23 | 南京邮电大学 | Medicine retrospective application oriented medicine inquiry optimization method |
CN105468777A (en) * | 2015-12-14 | 2016-04-06 | 江苏鼎峰信息技术有限公司 | Database connection structure based on json format |
CN105760532A (en) * | 2016-03-03 | 2016-07-13 | 江苏物联网研究发展中心 | Resource sharing system based on Web Service and resource sharing method based on Web Service |
CN106293714A (en) * | 2016-07-29 | 2017-01-04 | 四川天邑康和通信股份有限公司 | A kind of method of improvement ajax performance based on data Layer |
CN106886465A (en) * | 2015-12-16 | 2017-06-23 | 阿里巴巴集团控股有限公司 | A kind of data capture method and device |
CN107346320A (en) * | 2016-05-06 | 2017-11-14 | 北京神州泰岳软件股份有限公司 | A kind of data calling method and device |
CN107959548A (en) * | 2017-11-14 | 2018-04-24 | 北京思特奇信息技术股份有限公司 | A kind of method and system for handling service request |
CN109117207A (en) * | 2017-06-21 | 2019-01-01 | 深圳联友科技有限公司 | A kind of data processing method of business process model |
CN109286677A (en) * | 2018-10-25 | 2019-01-29 | 北京北信源信息安全技术有限公司 | A kind of method and device of the file transmission based on FTP |
CN110737636A (en) * | 2019-09-24 | 2020-01-31 | 厦门信息集团大数据运营有限公司 | data importing method, device and equipment |
CN111626018A (en) * | 2019-02-28 | 2020-09-04 | 北京数聚鑫云信息技术有限公司 | Method and device for constructing JSON formatted data |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050203939A1 (en) * | 2004-03-12 | 2005-09-15 | American Express Travel Related Services Company, Inc. | Method and system for facilitating access to external data |
CN103294700A (en) * | 2012-02-24 | 2013-09-11 | 腾讯科技(北京)有限公司 | Cross-browser data local storage method and device |
-
2013
- 2013-11-15 CN CN201310576688.3A patent/CN103577599A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050203939A1 (en) * | 2004-03-12 | 2005-09-15 | American Express Travel Related Services Company, Inc. | Method and system for facilitating access to external data |
CN103294700A (en) * | 2012-02-24 | 2013-09-11 | 腾讯科技(北京)有限公司 | Cross-browser data local storage method and device |
Non-Patent Citations (1)
Title |
---|
佚名: "jQuery调用WebService返回JSON数据", 《HTTP://DEVELOPER.51CTO.COM/ART/200907/138766.HTM》 * |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104376056A (en) * | 2014-11-04 | 2015-02-25 | 广州华多网络科技有限公司 | Data processing method and device |
CN104376056B (en) * | 2014-11-04 | 2018-04-27 | 广州华多网络科技有限公司 | A kind of method and apparatus of data processing |
CN104580417A (en) * | 2014-12-25 | 2015-04-29 | 中建材国际贸易有限公司 | Method for learning SCORM (sharable content object reference model) courseware on intelligent mobile terminal and intelligent mobile terminal |
CN104933487A (en) * | 2015-06-26 | 2015-09-23 | 南京邮电大学 | Medicine retrospective application oriented medicine inquiry optimization method |
CN105468777A (en) * | 2015-12-14 | 2016-04-06 | 江苏鼎峰信息技术有限公司 | Database connection structure based on json format |
CN106886465B (en) * | 2015-12-16 | 2021-06-15 | 菜鸟智能物流控股有限公司 | Data acquisition method and device |
CN106886465A (en) * | 2015-12-16 | 2017-06-23 | 阿里巴巴集团控股有限公司 | A kind of data capture method and device |
CN105760532A (en) * | 2016-03-03 | 2016-07-13 | 江苏物联网研究发展中心 | Resource sharing system based on Web Service and resource sharing method based on Web Service |
CN105760532B (en) * | 2016-03-03 | 2020-02-14 | 江苏物联网研究发展中心 | Resource sharing system and method based on Web Service |
CN107346320A (en) * | 2016-05-06 | 2017-11-14 | 北京神州泰岳软件股份有限公司 | A kind of data calling method and device |
CN106293714B (en) * | 2016-07-29 | 2020-01-14 | 四川天邑康和通信股份有限公司 | Data layer-based method for improving ajax performance |
CN106293714A (en) * | 2016-07-29 | 2017-01-04 | 四川天邑康和通信股份有限公司 | A kind of method of improvement ajax performance based on data Layer |
CN109117207A (en) * | 2017-06-21 | 2019-01-01 | 深圳联友科技有限公司 | A kind of data processing method of business process model |
CN109117207B (en) * | 2017-06-21 | 2021-11-23 | 深圳联友科技有限公司 | Data processing method of business process model |
CN107959548A (en) * | 2017-11-14 | 2018-04-24 | 北京思特奇信息技术股份有限公司 | A kind of method and system for handling service request |
CN107959548B (en) * | 2017-11-14 | 2020-09-01 | 北京思特奇信息技术股份有限公司 | Method and system for processing service request |
CN109286677A (en) * | 2018-10-25 | 2019-01-29 | 北京北信源信息安全技术有限公司 | A kind of method and device of the file transmission based on FTP |
CN111626018A (en) * | 2019-02-28 | 2020-09-04 | 北京数聚鑫云信息技术有限公司 | Method and device for constructing JSON formatted data |
CN110737636A (en) * | 2019-09-24 | 2020-01-31 | 厦门信息集团大数据运营有限公司 | data importing method, device and equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103577599A (en) | Method and device for storing local data through mobile terminal | |
US10318287B2 (en) | Deploying documents to a server in a specific environment | |
CN103645951A (en) | Cross-platform mobile data management system and method | |
CN100440208C (en) | A method and system for improving presentation of html pages in web devices | |
US20140282371A1 (en) | Systems and methods for creating or updating an application using a pre-existing application | |
CN101529415B (en) | Offline execution of web based applications | |
CN102955694B (en) | The client realization method of sing on web Kit browser and client | |
CA2831381C (en) | Recovery of tenant data across tenant moves | |
US20180246704A1 (en) | Systems and methods for transactional applications in an unreliable wireless network | |
US20140365668A1 (en) | Using a template to update a stack of resources | |
CN104731589A (en) | Automatic generation method and device of user interface (UI) | |
CN104049991A (en) | Method and system for converting network applications into mobile applications | |
MX2008011058A (en) | Rss data-processing object. | |
CN103309884A (en) | User behavior data collecting method and system | |
CN101944032A (en) | Microware updating method, client, server and system | |
CN102833350A (en) | Processing method and processing device of WebApp updating | |
CN104182408A (en) | Webpage off-line access method and webpage off-line access device | |
WO2013175560A1 (en) | Information communicating system and information converting method | |
US20130091416A1 (en) | Method for establishing a relationship between semantic data and the running of a widget | |
CN103377064A (en) | Page script loading method and page script loading device | |
CN102651021A (en) | Icon content updating method and device | |
CN112947992B (en) | Code version management method and device | |
CN103634393A (en) | IVR (interactive voice response) and realization method thereof | |
CN101876998A (en) | Method and system for editing data | |
US8930343B2 (en) | System and method for collecting document |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140212 |
|
RJ01 | Rejection of invention patent application after publication |