CN102073693A - XML-based data communication method and system - Google Patents

XML-based data communication method and system Download PDF

Info

Publication number
CN102073693A
CN102073693A CN 201010608746 CN201010608746A CN102073693A CN 102073693 A CN102073693 A CN 102073693A CN 201010608746 CN201010608746 CN 201010608746 CN 201010608746 A CN201010608746 A CN 201010608746A CN 102073693 A CN102073693 A CN 102073693A
Authority
CN
China
Prior art keywords
data
xml
label
xml document
tag
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
Application number
CN 201010608746
Other languages
Chinese (zh)
Inventor
郑瑞琳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GCI Science and Technology Co Ltd
Original Assignee
GCI Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by GCI Science and Technology Co Ltd filed Critical GCI Science and Technology Co Ltd
Priority to CN 201010608746 priority Critical patent/CN102073693A/en
Publication of CN102073693A publication Critical patent/CN102073693A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses an extensible markup language (XML)-based data communication method and an XML-based data communication system. The method comprises the following steps that: a transmitting terminal calls an XML generator, adds a tag for data to be transmitted according to a tag statement rule in a tag library, converts the tag into an XML document and transmits the XML document to a receiving terminal; and the receiving terminal calls an XML analyzer to receive a data stream of the XML document, identifies the XML document according to the tag statement rule in the tag library and resolves data. The method and the system can reduce the data communication complexity and data maintenance difficulty of mobile equipment, and can meet various communication service requirements of the mobile equipment.

Description

Data communication method and system based on XML
Technical field
The present invention relates to communication technique field, relate in particular to a kind of based on XML(Extensible Markup Language, extend markup language) data communication method and system.
Background technology
Along with popularizing of mobile communication equipment, the mobile data communication traffic constantly enlarges, and the communication data amount increases severely, and its data structure also becomes increasingly complex, pose a big pressure for the program development of mobile device client terminal/server structure, the data sync of carrying out server and client communication is especially important.The data communication agreement is to be the agreement of reaching synchronously that realizes data transfer between server and client, is the important component part of data communication mechanism.
At present, the data communication mechanism that mobile device is commonly used is to formulate an agreement for the communication of each business operation, with the transmission of corresponding protocol standard current business communication and the data layout of reception.Transmit leg writes data stream according to the form and the order of protocol definition one by one with data, and the take over party is according to the data implication of protocol definition, and reading of data is also stored from data stream.This agreement can be done corresponding design at each professional real needs with professional mechanism one to one, but increase along with portfolio, agreement will get more and more, it is more and more huger and complicated that this mechanism then becomes, cause development workload to increase greatly and problem such as difficult in maintenance, traditional simple communications protocol mechanism can't adapt to increasingly sophisticated communication traffic demand.
Summary of the invention
Technical matters to be solved by this invention is, a kind of data communication method and system are provided, and reduces the complicacy of mobile device data communication and the difficulty of data maintenance, to satisfy the various communication traffic demands of mobile device.
For solving above technical matters, the embodiment of the invention provides a kind of data communication method based on XML, comprising:
S1, transmission terminal call XML maker according to the statement of the label in tag library rule, become XML document with the data-switching that will send, and described XML document are sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
S2, receiving terminal call XML resolver receive described XML document data stream, according to the statement of the label in tag library rule described XML document are discerned, and decomposite data.
Correspondingly, the invention process also provides a kind of data communication system based on XML, comprises sending terminal and receiving terminal;
Described transmission terminal comprises:
The XML maker is used for the label statement rule according to tag library, the data-switching that send is become XML document, and described XML document is sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
Described receiving terminal comprises:
The XML resolver is used to receive the XML document data stream that described transmission terminal sends, and according to the statement of the label in tag library rule described XML document is discerned, and decomposites data.
Data communication method and system based on XML that the embodiment of the invention provides according to the communication traffic demand label allocation storehouse of mobile device, and state implication, attribute and the data type of each label; In process of data communication, send terminal and add corresponding label for the data that will send, convert XML document again to and be sent to receiving terminal; Receiving terminal is resolved the XML document that is received according to label statement rule, decomposites data.This communication mechanism can be a cover label protocol with the unification of various complicated service operation communications protocol, thereby has reduced the complicacy of mobile device data communication and the difficulty of data maintenance, can satisfy the various communication traffic demands of mobile device.
Description of drawings
Fig. 1 is the process flow diagram of first embodiment of the data communication method based on XML provided by the invention;
Fig. 2 is the process flow diagram of second embodiment of the data communication method based on XML provided by the invention;
Fig. 3 is the synoptic diagram of an embodiment of XML document provided by the invention;
Fig. 4 is the process flow diagram of the 3rd embodiment of the data communication method based on XML provided by the invention;
Fig. 5 is the structural drawing of an embodiment of the data communication system based on XML provided by the invention;
Fig. 6 is the structural drawing of an embodiment of XML maker provided by the invention;
Fig. 7 is the structural drawing of an embodiment of XML resolver provided by the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Extend markup language (hereinafter to be referred as XML) is a kind of simple data storage language, uses a series of simple mark data of description.The data communication method based on XML that the embodiment of the invention provides can reduce the complicacy of mobile device data communication and the difficulty of data maintenance, can satisfy the various communication traffic demands of mobile device.
Referring to Fig. 1, be the process flow diagram of first embodiment of the data communication method based on XML provided by the invention; This method specifically may further comprise the steps:
S1, transmission terminal call XML maker according to the statement of the label in tag library rule, add label for the data that will send, and convert XML document again to, and described XML document is sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
S2, receiving terminal call XML resolver receive described XML document data stream, according to the statement of the label in tag library rule described XML document are discerned, and decomposite data.
Wherein, the data in the described XML document are all with the string format storage, and support can be with any data layout of string format preservation, as fundamental types such as integer, floating type, byte types.As shown in Figure 2, above-mentioned step S1 specifically comprises:
S11, transmission terminal call XML maker are converted to character string with the data that will send;
S12, regular according to the type and the statement of the label in the tag library of each data that will send is that the character string after each data-switching is added corresponding label;
S13, described character string and the label that added are integrated into the XML structure, generate XML document;
S14, convert described XML document to byte stream and be sent to receiving terminal.
If the data that the transmission terminal will send comprise image data, then described step S11 specifically comprises: send terminal call XML maker, described image data is converted to bytecode, and is converted to the byte stream sign indicating number, more described byte stream sign indicating number is converted to character string by the BASE64 scrambled.
If the data that the transmission terminal will send comprise the array of integer, floating type, byte type or other fundamental types, then described step S11 specifically comprises: send terminal call XML maker, each array element in the described array is converted to character string respectively, between the character string after the conversion of each array element by character "; " connect, be combined into a character string.
In above-mentioned step S14, send the XML document that terminal sent and comprise at least one data block, each data block comprises bookmark name, tag attributes, tag head, label tail, and the data between described tag head and label tail.As shown in Figure 3, be the synoptic diagram of an embodiment of XML document.
Further, as shown in Figure 4, above-mentioned step S2 specifically comprises:
S21, receiving terminal call XML resolver receive the XML document byte stream that described transmission terminal sends;
S22, described XML document is scanned, read bookmark name, tag attributes in each data block, and the data between tag head and the label tail;
S23, according to each label of the statement rule identification of the label in the tag library, the data of each label correspondence are extracted one by one, described data are carried out format conversion;
S24, to the conversion after data store.
The data communication method based on XML that for example embodiment of the invention is provided describes below:
(1) it is as follows to send the data that terminal will send:
User name: XX;
Address: XXX;
Phone: 000.
(2) send terminal call XML maker, above-mentioned data are added label one by one according to label rule agreement.During concrete enforcement, can classify to data according to business demand, and add the label of many levels, the data of for example above-mentioned (1) classify as " subscriber data ", and be data " XX " interpolations " user name " labels, be data " XXX " interpolations " address " label, be data " 000 " interpolations " phone " label.The XML document of Sheng Chenging is as follows at last:
<subscriber data 〉
<user name〉XX</user name 〉
<address〉XXX</address 〉
<phone〉0000</phone 〉
</subscriber data 〉
(3) receiving terminal call XML resolver receives above-mentioned XML document data stream, and XML document is scanned, and reads the data in the XML document; And according to label rule agreement each label (being above-mentioned XML document) that reads is discerned, take out the pairing data of label that recognize, and data are changed, decomposite the data of above-mentioned (1).
The data communication method that the embodiment of the invention provides based on XML, communication mechanism can be a cover label protocol with the unification of various complicated service operation communications protocol, thereby reduced the complicacy of mobile device data communication and the difficulty of data maintenance, can satisfy the various communication traffic demands of mobile device.
Correspondingly, the embodiment of the invention also provides a kind of data communication system based on XML, and the institute that can implement above-mentioned data communication method based on XML in steps.
As shown in Figure 5, be the structural drawing of an embodiment of the data communication system based on XML provided by the invention; This system comprises transmission terminal 1 and receiving terminal 2, and is as follows:
Described transmission terminal 1 comprises:
XML maker 10 is used for the label statement rule according to tag library, adds label for the data that will send, and converts XML document again to, and described XML document is sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
Described receiving terminal 2 comprises:
XML resolver 20 is used to receive the XML document data stream that described transmission terminal sends, and according to the statement of the label in tag library rule described XML document is discerned, and decomposites data.
Wherein, the data in the described XML document are all stored with string format; Described XML document comprises at least one data block, and each data block comprises bookmark name, tag attributes, tag head, label tail, and the data between described tag head and label tail.
As shown in Figure 6, described XML maker 10 specifically comprises:
Date Conversion Unit 101, the data that are used for will sending are converted to character string;
Label adding device 102 is used for according to the type of each data that will send and the label statement rule of tag library, for the character string after each data-switching is added corresponding label;
XML integral unit 103 is used for described character string and the label that is added are integrated into the XML structure, generates XML document;
XML document transmitting element 104 is used for converting described XML document to byte stream and is sent to receiving terminal 2.
As shown in Figure 7, described XML resolver 20 specifically comprises:
XML document receiving element 201 is used to receive the XML document byte stream that described transmission terminal 1 sends;
XML scanning element 202 is used for described XML document is scanned, and reads bookmark name, tag attributes in each data block, and the data between tag head and the label tail;
Data extracting unit 203 is used for according to each label of the label of tag library statement rule identification, and the data of each label correspondence are extracted one by one, and described data are carried out format conversion;
Data storage cell 204 is used to store the data after the conversion.
Need to prove that the data communication system based on XML that the embodiment of the invention provides sends the treatment scheme of carrying out data communication between terminal and the receiving terminal, identical with the flow process of above-mentioned data communication method based on XML, do not repeat them here.
Data communication method and system based on XML that the embodiment of the invention provides according to the communication traffic demand label allocation storehouse of mobile device, and state implication, attribute and the data type of each label; In process of data communication, send terminal and add corresponding label for the data that will send, convert XML document again to and be sent to receiving terminal; Receiving terminal is resolved the XML document that is received according to label statement rule, decomposites data.This communication mechanism can be a cover label protocol with the unification of various complicated service operation communications protocol, thereby has reduced the complicacy of mobile device data communication and the difficulty of data maintenance, can satisfy the various communication traffic demands of mobile device.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
The above is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also are considered as protection scope of the present invention.

Claims (10)

1. the data communication method based on XML is characterized in that, comprising:
S1, transmission terminal call XML maker according to the statement of the label in tag library rule, add label for the data that will send, and convert XML document again to, and described XML document is sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
S2, receiving terminal call XML resolver receive described XML document data stream, according to the statement of the label in tag library rule described XML document are discerned, and decomposite data.
2. the data communication method based on XML as claimed in claim 1 is characterized in that, all with the string format storage, then described step S1 specifically comprises the data in the described XML document:
S11, transmission terminal call XML maker are converted to character string with the data that will send;
S12, regular according to the type and the statement of the label in the tag library of each data that will send is that the character string after each data-switching is added corresponding label;
S13, described character string and the label that added are integrated into the XML structure, generate XML document;
S14, convert described XML document to byte stream and be sent to receiving terminal.
3. the data communication method based on XML as claimed in claim 2, it is characterized in that, described XML document comprises at least one data block, and each data block comprises bookmark name, tag attributes, tag head, label tail, and the data between described tag head and label tail.
4. the data communication method based on XML as claimed in claim 3 is characterized in that, described step S2 specifically comprises:
S21, receiving terminal call XML resolver receive the XML document byte stream that described transmission terminal sends;
S22, described XML document is scanned, read bookmark name, tag attributes in each data block, and the data between tag head and the label tail;
S23, according to each label of the statement rule identification of the label in the tag library, the data of each label correspondence are extracted one by one, described data are carried out format conversion;
S24, to the conversion after data store.
5. as each described data communication method based on XML of claim 2~4, it is characterized in that the data that described transmission terminal will send comprise image data, then described step S11 specifically comprises:
Send terminal call XML maker, described image data is converted to bytecode, and is converted to the byte stream sign indicating number, more described byte stream sign indicating number is converted to character string by the BASE64 scrambled.
6. as each described data communication method based on XML of claim 2~4, it is characterized in that the data that described transmission terminal will send comprise integer, floating type or byte type array, then described step S11 specifically comprises:
Send terminal call XML maker, each array element in the described array is converted to character string respectively, connect by character ", " between the character string after each array element conversion, be combined into a character string.
7. the data communication system based on XML comprises sending terminal and receiving terminal, it is characterized in that described transmission terminal comprises:
The XML maker is used for the label statement rule according to tag library, adds label for the data that will send, and converts XML document again to, and described XML document is sent to receiving terminal;
Wherein, described tag library is that each label has specific implication, attribute and data type, is used for the data that the mark communication transmits according to the set of a plurality of labels of the communication traffic demand configuration of mobile device;
Described receiving terminal comprises:
The XML resolver is used to receive the XML document data stream that described transmission terminal sends, and according to the statement of the label in tag library rule described XML document is discerned, and decomposites data.
8. the data communication system based on XML as claimed in claim 7 is characterized in that the data in the described XML document are all stored with string format;
Described XML document comprises at least one data block, and each data block comprises bookmark name, tag attributes, tag head, label tail, and the data between described tag head and label tail.
9. the data communication system based on XML as claimed in claim 8 is characterized in that, described XML maker specifically comprises:
Date Conversion Unit, the data that are used for will sending are converted to character string;
The label adding device is used for according to the type of each data that will send and the label statement rule of tag library, for the character string after each data-switching is added corresponding label;
The XML integral unit is used for described character string and the label that is added are integrated into the XML structure, generates XML document;
The XML document transmitting element is used for converting described XML document to byte stream and is sent to receiving terminal.
10. as claimed in claim 8 or 9 based on the data communication system of XML, it is characterized in that described XML resolver specifically comprises:
The XML document receiving element is used to receive the XML document byte stream that described transmission terminal sends;
The XML scanning element is used for described XML document is scanned, and reads bookmark name, tag attributes in each data block, and the data between tag head and the label tail;
Data extracting unit is used for according to each label of the label of tag library statement rule identification, and the data of each label correspondence are extracted one by one, and described data are carried out format conversion;
Data storage cell is used to store the data after the conversion.
CN 201010608746 2010-12-28 2010-12-28 XML-based data communication method and system Pending CN102073693A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010608746 CN102073693A (en) 2010-12-28 2010-12-28 XML-based data communication method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010608746 CN102073693A (en) 2010-12-28 2010-12-28 XML-based data communication method and system

Publications (1)

Publication Number Publication Date
CN102073693A true CN102073693A (en) 2011-05-25

Family

ID=44032232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010608746 Pending CN102073693A (en) 2010-12-28 2010-12-28 XML-based data communication method and system

Country Status (1)

Country Link
CN (1) CN102073693A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103561105A (en) * 2013-11-11 2014-02-05 中国联合网络通信集团有限公司 Image transmitting method, sending end and receiving end
CN103902588A (en) * 2012-12-27 2014-07-02 腾讯科技(深圳)有限公司 Webpage access method and user terminal
CN108462553A (en) * 2017-02-17 2018-08-28 中国移动通信集团内蒙古有限公司 A kind of data transmission method, device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464435A (en) * 2002-06-26 2003-12-31 联想(北京)有限公司 Process of data exchange between a flush type system and external data base
CN101478730A (en) * 2007-11-12 2009-07-08 华为技术有限公司 Data exchanging method, system and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464435A (en) * 2002-06-26 2003-12-31 联想(北京)有限公司 Process of data exchange between a flush type system and external data base
CN101478730A (en) * 2007-11-12 2009-07-08 华为技术有限公司 Data exchanging method, system and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902588A (en) * 2012-12-27 2014-07-02 腾讯科技(深圳)有限公司 Webpage access method and user terminal
CN103561105A (en) * 2013-11-11 2014-02-05 中国联合网络通信集团有限公司 Image transmitting method, sending end and receiving end
CN108462553A (en) * 2017-02-17 2018-08-28 中国移动通信集团内蒙古有限公司 A kind of data transmission method, device and electronic equipment
CN108462553B (en) * 2017-02-17 2021-04-13 中国移动通信集团内蒙古有限公司 Data transmission method and device and electronic equipment

Similar Documents

Publication Publication Date Title
RU2488228C2 (en) Web format-based wireless communication
CN1867142B (en) Method and system for mobile terminal device obtaining computer information
CN104798082A (en) Method and apparatus for providing privacy policy for data stream
CN105429858A (en) Real-time message transmission method among multiple robots
CN101867572B (en) The implementation method of wireless U disk and system
CN102053952A (en) Method and device for converting data format of electronic book and portable electronic book reader
CN110290127A (en) A kind of message forwarding method and message converting system
CN202127427U (en) Bluetooth advertisement terminal with various networking modes
CN101631261B (en) Signaling tracking method, signaling tracking background device and tracking system
CN102804726A (en) Method And Apparatus For Message Routing Optimization
CN102025727B (en) Integrated pushing system and method for collecting and accessing multiple application systems
CN103532959A (en) Cross-platform network communication method
CN112291223A (en) Solution for mobile phone terminal not supporting 5G message
CN102073693A (en) XML-based data communication method and system
CN107463536A (en) A kind of method and system for realizing document in online preview server in Android device
EP2464154B1 (en) Apparatus and method of open mobile alliance
CN101702732A (en) Document synchronous method and document synchronous system
CN105610701A (en) Instant messaging method, device and system
CN102802197A (en) Method and device for transmitting application data
CN102523271A (en) Terminal and communication method and system thereof
CN102843345B (en) Remote communication method and computer program product thereof
CN102104658A (en) Method, system and mobile terminal for sending expression by using short messaging service (SMS)
CN102316415B (en) Mobile communication terminal and communication service sharing method thereof
CN101127984B (en) Fault tolerant user interface for wireless device
CN1723722A (en) Converter for mobile radio networks for the generation of standard formats

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20110525