CN103729339B - A kind of document conversion method and device - Google Patents

A kind of document conversion method and device Download PDF

Info

Publication number
CN103729339B
CN103729339B CN201410038983.8A CN201410038983A CN103729339B CN 103729339 B CN103729339 B CN 103729339B CN 201410038983 A CN201410038983 A CN 201410038983A CN 103729339 B CN103729339 B CN 103729339B
Authority
CN
China
Prior art keywords
xml document
write
name information
excel forms
excel
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.)
Active
Application number
CN201410038983.8A
Other languages
Chinese (zh)
Other versions
CN103729339A (en
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.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology 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 Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201410038983.8A priority Critical patent/CN103729339B/en
Publication of CN103729339A publication Critical patent/CN103729339A/en
Application granted granted Critical
Publication of CN103729339B publication Critical patent/CN103729339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a kind of document conversion method and device, solve prior art cannot a large amount of xml documents of batch processing technological deficiency, and, process is merged to identical node, avoid the action such as insertion and merging, so as to further shorten process time, treatment effeciency is greatly improved.Wherein, a kind of document conversion method step provided in an embodiment of the present invention includes:S1:Search xml document, and the most xml document of node is extracted for the first xml document;S2:First xml document is write in excel forms according to the first prepattern according to the name information of the first xml document;S3:Non- first xml document is write in excel forms according to the second prepattern related to non-first xml document, and process is merged to identical node;S4:The namespace information of the first xml document and non-first xml document is preserved in excel forms first cell.

Description

A kind of document conversion method and device
Technical field
The present invention relates to field of computer technology, more particularly to a kind of document conversion method and device.
Background technology
xml(Extensible markup language), it is the subset of standard generalized markup language, one kind makes which for labelling e-file With structural markup language, it is to provide unified method to describe and exchange the structure independently of application program or supplier Change data, especially apply in Android platform, the character string translation of various language is individually for a file, and the inside is deposited Corresponding xml document is put, in the pattern of software outsourcing, developer is responsible for developing software, the word and other language in software Translation is typically provided by the client of developer, but the form of xml document is more hard to understand for general user, and different language File be independent, be not easy to go to increase or change other language with reference to certain language translation, therefore, xml document with The exchange technology of excel files is arisen spontaneously, for Android character strings xml document includes two kinds of node again: String and string-array, the former only includes the name and corresponding language translation of a character string, referred to herein as Value, but string-array has the child node of or more.
The xml document of current Android character strings and the exchange technology of excel files, have Microsoft Microsoft Excel softwares possess the exchange function of xml document and excel files.
But, existing Microsoft Microsoft Excel softwares can only change single xml document in excel, work as process During a large amount of xml documents, by using existing technology so that therefore the time of process also waste, and efficiency is also further reduced .
The content of the invention
Embodiments provide a kind of document conversion method and device, solve prior art cannot batch processing it is big The technological deficiency of amount xml document, and, the most xml document of node is first write, the time of overall transformation is reduced, and to phase With node merge processs, it is to avoid the action such as insertion and merging, so as to further shorten process time, greatly improve place Reason efficiency.
A kind of document conversion method provided in an embodiment of the present invention, including:
S1:Search xml document, and the most xml document of node is extracted for the first xml document;
S2:First xml document is write according to the first prepattern according to the name information of first xml document In excel forms;
S3:Will be the non-first xml document write described according to second prepattern related to non-first xml document In excel forms, and process is merged to identical node;
S4:First xml document and non-first xml document are preserved in the excel forms first cell Namespace information.
Alternatively, step S2 is specifically included:
S21:Judge the first xml document type, if the first xml document type is string, execution step S22, if the first xml document type is string-array, execution step S23;
S22:The name information of first xml document is write into the excel forms first row, value information is write Enter into the excel forms secondary series;
S23:The name information of first xml document is write into the excel forms first row, from the excel The row of form the 3rd start, and the child node name information of first xml document and the value information are write successively.
Alternatively, step S3 is specifically included:
S31:Judge the non-first xml document type, if the non-first xml document type is string, perform Step S32, the non-first xml document type are string-array, then execution step S33;
S32:Search in the excel forms whether existing with the non-first xml document name information identical institute Name information is stated, the value information corresponding with the non-first xml document name information is if so, then write, if it is not, then will The non-first xml document name information writes described excel forms last column with the value information, and to identical Node merges process;
S33:Search in the excel forms whether existing with the non-first xml document child node name information phase The same name information, if so, then matches to the name information and quantity of the child node, if it is not, then will be described non- The child node name information of the first xml document writes described excel forms last column with value information, and to identical Node merge process.
A kind of document conversion method provided in an embodiment of the present invention, including:
File is set up according to the value information in excel forms, and creates xml document;
The namespace information of the excel forms first cell is read, and writes the xml document;
Will be the value information corresponding with the name information of the name information in the excel forms pre- according to the 3rd Put pattern to write in the xml document.
Alternatively, by the value information corresponding with the name information of the name information in the excel forms according to 3rd prepattern is specifically included in writing the xml document:
Described in the value information corresponding with the name information according to the name information in the excel forms judges The name information corresponding value information permutation if string types, is then write the xml by xml document type In file, the child node name information of the name information if string-array types, then read, and by the child node Name information and the corresponding value information of the child node name information write the xml document.
A kind of file conversion device provided in an embodiment of the present invention, including:
Extraction module, for searching for xml document, and extracts the most xml document of node for the first xml document;
First writing module, for will be described according to the first prepattern according to the name information of first xml document In first xml document write excel forms;
Second writing module, for according to second prepattern related to non-first xml document by a non-xml File is write in the excel forms, and merges process to identical node;
Attribute module, for preserving first xml document and described non-the in the excel forms first cell The namespace information of one xml document.
Alternatively, the first writing module is specifically included:
First judging submodule, for judging the first xml document type, if the first xml document type is String, then triggering first write submodule, if the first xml document type is string-array, triggering second is write Enter submodule;
The first write submodule, for the name information of first xml document is write into the excel forms First row, value information are write into the excel forms secondary series;
The second write submodule, for the name information of first xml document is write into the excel forms First row, from the beginning of the excel forms the 3rd row, by the child node name information and the value of first xml document Information is write successively.
Alternatively, the second writing module is specifically included:
Second judging submodule, for judging the non-first xml document type, if the non-first xml document type For string, then trigger the 3rd and write submodule, the non-first xml document type is string-array, then trigger the 4th Write submodule;
The 3rd write submodule, it is whether existing literary with a non-xml in the excel forms for searching for Name information described in part name information identicals, if so, then writes corresponding with the non-first xml document name information Value information, if it is not, the non-first xml document name information is write the excel forms with the value information then Last column, and process is merged to identical node;
The 4th write submodule, it is whether existing literary with a non-xml in the excel forms for searching for Name information described in part child node name information identical, is if so, then carried out to the name information and quantity of the child node Match somebody with somebody, if it is not, the child node name information of non-first xml document is write the excel forms with value information then Last column, and process is merged to identical node.
A kind of file conversion device provided in an embodiment of the present invention, including:
Creation module, for setting up file according to the value information in excel forms, and creates xml document;
3rd writing module, for reading the namespace information of the excel forms first cell, and writes institute State xml document;
4th writing module, for the name information in the excel forms is corresponding with the name information Value information is write in the xml document according to the 3rd prepattern.
Alternatively, the 4th writing module is specifically included:
3rd judging submodule, for corresponding with the name information according to the name information in the excel forms Value information judge the xml types, if string types, then by the name information corresponding value information Permutation is write in the xml document, if string-array types, then read the child node name letter of the name information Breath, and the child node name information and the corresponding value information of the child node name information are write into the xml document.
As can be seen from the above technical solutions, the embodiment of the present invention has advantages below:
A kind of document conversion method provided in an embodiment of the present invention and device, wherein, a kind of document conversion method step bag Include:S1:Search xml document, and the most xml document of node is extracted for the first xml document;S2:According to the first xml document Name information writes the first xml document in excel forms according to the first prepattern;S3:According to non-first xml document phase The second prepattern for closing writes non-first xml document in excel forms, and merges process to identical node;S4: The namespace information of the first xml document and non-first xml document is preserved in excel forms first cell.The present embodiment In, by writing the most xml document of node according to the first prepattern, according still further to related to non-first xml document second Prepattern writes non-first xml document in excel forms, and solving prior art cannot a large amount of xml document of batch processing Technological deficiency, and, first write the most xml document of node, reduce the time of overall transformation, meanwhile, to identical section Point carries out merging treatment, it is to avoid insertion and the action such as merge, and so as to further shorten process time, greatly improves process effect Rate.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also To obtain other accompanying drawings according to these accompanying drawings.
Fig. 1 is a kind of schematic flow sheet of one embodiment of document conversion method provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic flow sheet of another embodiment of document conversion method provided in an embodiment of the present invention;
Fig. 3 is a kind of schematic flow sheet of another embodiment of document conversion method provided in an embodiment of the present invention;
Fig. 4 is a kind of schematic flow sheet of one embodiment of document conversion method provided in an embodiment of the present invention;
Fig. 5 is a kind of structural representation of one embodiment of file conversion device provided in an embodiment of the present invention;
Fig. 6 is a kind of structural representation of another embodiment of file conversion device provided in an embodiment of the present invention;
Fig. 7 is a kind of structural representation of one embodiment of file conversion device provided in an embodiment of the present invention.
Specific embodiment
Embodiments provide a kind of document conversion method and device, solve prior art cannot batch processing it is big The technological deficiency of amount xml document, and, the most xml document of node is first write, the time of overall transformation is reduced, and to phase With node merge processs, it is to avoid the action such as insertion and merging, so as to further shorten process time, greatly improve place Reason efficiency.
To enable goal of the invention of the invention, feature, advantage more obvious and understandable, below in conjunction with the present invention Accompanying drawing in embodiment, is clearly and completely described to the technical scheme in the embodiment of the present invention, it is clear that disclosed below Embodiment be only a part of embodiment of the invention, and not all embodiment.Based on the embodiment in the present invention, this area All other embodiment that those of ordinary skill is obtained under the premise of creative work is not made, belongs to protection of the present invention Scope.
Fig. 1 is referred to, a kind of one embodiment of document conversion method provided in an embodiment of the present invention includes:
S1:Search xml document, and the most xml document of node is extracted for the first xml document;
In the embodiment of the present invention, when needs are in android system, by the xml of the string resource file of application program When file is converted into corresponding excel files, needs first to search for xml document in systems, and extract the most xml document of node For the first xml document, it should be noted that aforesaid search for xml document in systems, can be that traversal two-layer file is searched Rope, and the most xml document of node is extracted for the first xml document.
S2:First xml document is write according to the first prepattern by excel tables according to the name information of the first xml document In lattice;
After the most xml document of node is extracted for the first xml document, according to the name information of the first xml document The first xml document is write in excel forms according to the first prepattern.
It should be noted that, aforesaid first prepattern will be illustrated in follow-up embodiment, therefore is no longer gone to live in the household of one's in-laws on getting married here State.
S3:Non- first xml document is write into excel forms according to the second prepattern related to non-first xml document In, and process is merged to identical node;
In this enforcement, when the first xml document is write by the name information according to the first xml document according to the first prepattern After in excel forms, other non-first xml documents are write according to the second prepattern related to non-first xml document Enter in excel forms, it is to be understood that aforesaid non-first xml document can be one, or multiple, herein specifically Do not limit, if the node of the first xml document possesses identical node with non-first xml document node, carry out node merging Process, if can also be, multiple non-first xml documents possess identical node, carry out node merging.
It should be noted that, aforesaid second prepattern will be illustrated in follow-up embodiment, therefore is no longer gone to live in the household of one's in-laws on getting married here State.
S4:The NameSpace letter of the first xml document and non-first xml document is preserved in excel forms first cell Breath.
In the present embodiment, when other non-first xml documents are according to second prepattern related to non-first xml document After in write excel forms, now, all of xml document is all written with an excel, is needed in excel forms first Individual cell preserves the namespace information of the first xml document and non-first xml document, it is to be understood that aforesaid first Individual cell is the cell of first row the first row in excel forms, and aforesaid NameSpace is an attribute of xml document.
In the present embodiment, by writing the most xml document of node according to the first prepattern, according still further to non-first The second related prepattern of xml document writes non-first xml document in excel forms, and solving prior art cannot criticize Amount processes the technological deficiency of a large amount of xml documents, and, first write the most xml document of node, reduce overall transformation when Between, meanwhile, process is merged to identical node, it is to avoid insertion and the action such as merge, during so as to further shortening process Between, greatly improve treatment effeciency.
The above is that the process that character string xml document changes excel files is described in detail, below will be pre- to first The ablation process for putting pattern is described in detail, and refers to Fig. 2, a kind of document conversion method provided in an embodiment of the present invention Another embodiment includes:
201st, xml document is searched for, and the most xml document of node is extracted for the first xml document;
In the embodiment of the present invention, when needs are in android system, by the xml of the string resource file of application program When file is converted into corresponding excel files, needs first to search for xml document in systems, and extract the most xml document of node For the first xml document, it should be noted that aforesaid search for xml document in systems, can be that traversal two-layer file is searched Rope, and the most xml document of node is extracted for the first xml document.
202nd, judge the first xml document type, if the first xml document type is string, execution step 203, if the One xml document type is string-array, then execution step 204;
After the most xml document of node being extracted for the first xml document, need the first xml document to extracting Type judged, if judging the type of the first xml document for string, execution step 203, if judging, an xml is literary The type of part is string-array, then execution step 204.
It should be noted that the aforesaid type for judging xml document is known technology for string or string-array, Therefore no longer specifically repeat herein.
203rd, the name information of the first xml document is write into excel form first rows, value information is write into excel Form secondary series;
After string is judged as to the first xml document type, by the name information of the first xml document write into Excel form first rows, value information are write into excel form secondary series, it should be noted that including in the first xml document There are multiple name information, then each name information corresponds to a value information, each value information corresponds to each of secondary series OK.
204th, the name information of the first xml document is write into excel form first rows, is opened from the row of excel forms the 3rd Begin, the child node name information and value information of the first xml document are write successively;
After string-array is judged as to the first xml document type, the name information of the first xml document is write Enter excel form first rows, from the beginning of arranging from excel forms the 3rd, by the child node name information and value of the first xml document Information is write successively, it should be noted that include multiple child node name information in the first xml document, then each child node Name information one value information of correspondence.
205th, non-first xml document is write into excel forms according to the second prepattern related to non-first xml document In, and process is merged to identical node;
In this enforcement, when the first xml document is write by the name information according to the first xml document according to the first prepattern After in excel forms, other non-first xml documents are write according to the second prepattern related to non-first xml document Enter in excel forms, it is to be understood that aforesaid non-first xml document can be one, or multiple, herein specifically Do not limit, it is to be understood that if the node of the first xml document possesses identical node with non-first xml document node, Node merging treatment is carried out, multiple non-first xml documents possess identical node if can also be, carry out node merging.
It should be noted that, aforesaid second prepattern will be illustrated in follow-up embodiment, therefore is no longer gone to live in the household of one's in-laws on getting married here State.
206th, the NameSpace letter of the first xml document and non-first xml document is preserved in excel forms first cell Breath.
In the present embodiment, when other non-first xml documents are according to second prepattern related to non-first xml document After in write excel forms, now, all of xml document is all written with an excel, is needed in excel forms first Individual cell preserves the namespace information of the first xml document and non-first xml document, it is to be understood that aforesaid first Individual cell is the cell of first row the first row in excel forms, and aforesaid NameSpace is an attribute of xml document.
In the present embodiment, by the first xml document for extracting the most xml document of write node, and to different types of First xml document carries out different process, according still further to second prepattern related to non-first xml document by a non-xml File write excel forms in, solve prior art cannot a large amount of xml documents of batch processing technological deficiency, and, first write The most xml document of ingress, reduces the time of overall transformation, meanwhile, process is merged to identical node, it is to avoid Insertion and the action such as merge, so as to further shorten process time, greatly improve treatment effeciency, meanwhile, to different types of the One xml document carries out different process so that conversion efficiency is further enhanced.
The above is that the ablation process to the first prepattern is described in detail, and the second prepattern will be write below Enter process to be described in detail, refer to Fig. 3, a kind of another enforcement of document conversion method provided in an embodiment of the present invention Example includes:
301st, xml document is searched for, and the most xml document of node is extracted for the first xml document;
In the embodiment of the present invention, when needs are in android system, by the xml of the string resource file of application program When file is converted into corresponding excel files, needs first to search for xml document in systems, and extract the most xml document of node For the first xml document, it should be noted that aforesaid search for xml document in systems, can be that traversal two-layer file is searched Rope, and the most xml document of node is extracted for the first xml document.
302nd, judge the first xml document type, if the first xml document type is string, execution step 303, if the One xml document type is string-array, then execution step 304;
After the most xml document of node being extracted for the first xml document, need the first xml document to extracting Type judged, if judging the type of the first xml document for string, execution step 303, if judging, an xml is literary The type of part is string-array, then execution step 304.
It should be noted that the aforesaid type for judging xml document is known technology for string or string-array, Therefore no longer specifically repeat herein.
303rd, the name information of the first xml document is write into excel form first rows, value information is write into excel Form secondary series;
After string is judged as to the first xml document type, by the name information of the first xml document write into Excel form first rows, value information are write into excel form secondary series, it should be noted that including in the first xml document There are multiple name information, then each name information corresponds to a value information, each value information corresponds to each of secondary series OK.
304th, the name information of the first xml document is write into excel form first rows, is opened from the row of excel forms the 3rd Begin, the child node name information and value information of the first xml document are write successively;
After string-array is judged as to the first xml document type, the name information of the first xml document is write Enter excel form first rows, from the beginning of arranging from excel forms the 3rd, by the child node name information and value of the first xml document Information is write successively, it should be noted that include multiple child node name information in the first xml document, then each child node Name information one value information of correspondence.
305th, judge non-first xml document type, if not the first xml document type is string, then execution step 306, Non- first xml document type is string-array, then execution step 307;
In this enforcement, after different the first xml documents of type is write in excel forms according to different modes, Need, by other non-first xml document write excel forms, to need to judge non-first xml document type, if judging non- First xml document type is string, then execution step 306, if judging non-first xml document type for string-array, Then execution step 307.
306th, search in excel forms whether existing with non-first xml document name information identical name information, if It is then to write the value information corresponding with non-first xml document name information, if it is not, then by non-first xml document name Information writes excel form last columns with value information, and merges process to identical node;
When judging non-first xml document type for string, it is necessary first to search in excel forms whether it is existing with it is non- First xml document name information identical name information, if so, then writes corresponding with non-first xml document name information Value information, if it is not, non-first xml document name information is write excel form last columns with value information then, needs It is understood that aforesaid non-first xml document can be one, or it is multiple, specifically do not limit herein, Ke Yili Solution, if the node of the first xml document possesses identical node with non-first xml document node, is carried out at node merging Reason, if can also be, multiple non-first xml documents possess identical node, carry out node merging.
307th, search in excel forms whether existing with non-first xml document child node name information identical name Information, if so, then matches to the name information and quantity of child node, if it is not, then by the child node of non-first xml document Name information writes excel form last columns with value information, and merges process to identical node;
It is when judging non-first xml document type for string-array, whether existing with non-the in search excel forms One xml document child node name information identical name information, is if so, then carried out to the name information and quantity of child node Match somebody with somebody, if it is not, the child node name information of non-first xml document is write excel form last columns with value information then, need It is it is understood that aforesaid non-first xml document can be one or multiple, specifically do not limit herein, can be with It is understood by, if the node of the first xml document possesses identical node with non-first xml document node, carries out node merging Process, if can also be, multiple non-first xml documents possess identical node, carry out node merging.
308th, the NameSpace letter of the first xml document and non-first xml document is preserved in excel forms first cell Breath.
In the present embodiment, when other non-first xml documents are according to second prepattern related to non-first xml document After in write excel forms, now, all of xml document is all written with an excel, is needed in excel forms first Individual cell preserves the namespace information of the first xml document and non-first xml document, it is to be understood that aforesaid first Individual cell is the cell of first row the first row in excel forms, and aforesaid NameSpace is an attribute of xml document.
In the present embodiment, by the first xml document for extracting the most xml document of write node, and to different types of First xml document carries out different process, then different types of non-first xml document difference writing mode is write excel tables In lattice, solve prior art cannot a large amount of xml documents of batch processing technological deficiency, and, first write the most xml of node File, reduce the time of overall transformation, meanwhile, process is merged to identical node, it is to avoid insertion and merge etc. dynamic Make, so as to further shorten process time, greatly improve treatment effeciency, meanwhile, different types of first xml document is carried out not Same process, by different types of non-first xml document difference writing modes write excel forms so that conversion efficiency is entered One step is improved.
Below will be to another kind of document conversion method provided in an embodiment of the present invention, based on any one shown in Fig. 1 to Fig. 3 Plant document conversion method to be applied, refer to Fig. 4, an a kind of enforcement of document conversion method provided in an embodiment of the present invention Example includes:
401st, file is set up according to the value information in excel forms, and creates xml document;
In the present embodiment, a kind of document conversion method provided in needing using Fig. 1 to embodiment illustrated in fig. 3 is by The converted xml document into excel, when being converted back, it is necessary first to which file is set up according to the value information in excel forms Folder, and create xml document, such as from the beginning of the secondary series of excel, the value information of the first row is read in circulation, with the value Information sets up file, creates xml document in this document underedge, and the xml document is string.xml files.
402nd, the namespace information of excel form first cells is read, and writes xml document;
When file being set up according to the value information in excel forms, and after creating xml document, read excel tables The namespace information of lattice first cell, and xml document is write, the xml document is string.xml files, needs explanation , aforementioned excel forms first cell is the cell of first row the first row in excel forms, is to turn xml in advance Change what is arranged during excel into.
403rd, by the name information in excel forms corresponding with name information value information according to the 3rd preset mould In formula write xml document.
After it will read the namespace information write xml document of excel form first cells, by excel tables Name information in the lattice value information corresponding with name information is according in the 3rd prepattern write xml document.
It should be noted that, aforesaid 3rd prepattern can be according to the name information and name in excel forms The corresponding value information of information judges that xml document type is string types, then by name information corresponding value information In permutation write xml document, can also be according to the value letter corresponding with name information of the name information in excel forms Breath judges that xml document type is string-array types, then the child node name information of reading name information, and by child node Name information and the corresponding value information of child node name information write xml document.
In the present embodiment, by will be converted using a kind of document conversion method provided in Fig. 1 to embodiment illustrated in fig. 3 Into the xml document of excel, by file being set up according to the value information in excel forms first, and create xml document, Then, the namespace information of excel form first cells is read, and writes xml document, finally by excel forms The name information value information corresponding with name information according to the 3rd prepattern write xml document in, just realize Excel files are converted into the function of xml document, further solve in Android platform, and existing technology does not possess handle Excel file is converted into the technical problem of the xml document of form required by android system, meanwhile, with Android system User it is more and more, meet the demand of present Android system user, greatly extend economic market.
Fig. 5 is referred to, a kind of one embodiment of file conversion device provided in an embodiment of the present invention includes:
Extraction module 501, for searching for xml document, and extracts the most xml document of node for the first xml document;
First writing module 502, for the name information according to the first xml document according to the first prepattern by first In xml document write excel forms;
Second writing module 503, for according to second prepattern related to non-first xml document by a non-xml In file write excel forms, and process is merged to identical node;
Attribute module 504, for preserving the first xml document and non-first xml document in excel forms first cell Namespace information.
In the present embodiment, the first xml document of the write most xml document of node is extracted by extraction module 501, first Writing module 502 carries out different process to different types of first xml document, and the second writing module 503 will be different types of In non-first xml document difference writing mode write excel forms, solve prior art cannot a large amount of xml of batch processing it is literary The technological deficiency of part, and, the most xml document of node is first write, the time of overall transformation is reduced, meanwhile, to identical Node merges process, it is to avoid insertion and the action such as merge, and so as to further shortening process time, greatly improves process effect Rate.
The above is that each module to file conversion device is described in detail, and is carried out the function to submodule in detail below Thin explanation, refers to Fig. 6, and a kind of another embodiment of file conversion device provided in an embodiment of the present invention includes:
Extraction module 601, for searching for xml document, and extracts the most xml document of node for the first xml document;
First writing module 602, for the name information according to the first xml document according to the first prepattern by first In xml document write excel forms;、
Wherein, the first writing module 602 can further include:
First judging submodule 6021, for judging the first xml document type, if the first xml document type is string, Then triggering first writes submodule 6022, if the first xml document type is string-array, triggering second writes submodule 6023;
First write submodule 6022, for the name information of the first xml document is write into excel form first rows, Value information is write into excel form secondary series;
Second write submodule 6023, for the name information of the first xml document is write into excel form first rows, From the beginning of arranging from excel forms the 3rd, the child node name information and value information of the first xml document are write successively.
Second writing module 603, for according to second prepattern related to non-first xml document by a non-xml In file write excel forms, and process is merged to identical node;
Wherein, the second writing module 603 can further include:
Second judging submodule 6031, for judging non-first xml document type, if not the first xml document type is String, then triggering the 3rd write submodule 6032, and non-first xml document type is string-array, then triggering the 4th is write Enter submodule 6033;
Whether the 3rd write submodule 6032, existing believed with non-first xml document name for searching in excel forms Breath identical name information, if so, then writes the value information corresponding with non-first xml document name information, if it is not, then Non- first xml document name information is write into excel form last columns with value information, and identical node is closed And process;
4th write submodule 6033, it is whether existing with non-first xml document child node for searching in excel forms Name information identical name information, if so, then matches to the name information and quantity of child node, if it is not, then by non- The child node name information of one xml document writes excel form last columns with value information, and identical node is carried out Merging treatment.
Attribute module 604, for preserving the first xml document and non-first xml document in excel forms first cell Namespace information.
In the present embodiment, the first xml document of the write most xml document of node is extracted by extraction module 601, first Writing module 602 and each submodule carry out different process to different types of first xml document, the second writing module 603 and Each submodule will in different types of non-first xml document difference writing mode write excel forms, solve prior art without The technological deficiency of a large amount of xml documents of method batch processing, and, the most xml document of node is first write, overall transformation is reduced Time, meanwhile, process is merged to identical node, it is to avoid insertion and the action such as merge, so as to further shortening is processed Time, treatment effeciency is greatly improved, meanwhile, different process are carried out to different types of first xml document, will be different types of In non-first xml document difference writing mode write excel forms so that conversion efficiency is further enhanced.
Fig. 7 is referred to, a kind of one embodiment of file conversion device provided in an embodiment of the present invention includes:
Creation module 701, for setting up file according to the value information in excel forms, and creates xml document;
3rd writing module 702, for reading the namespace information of excel form first cells, and writes xml File;
4th writing module 703, for the name information in excel forms corresponding with name information value is believed Breath is according in the 3rd prepattern write xml document.
Wherein, the 4th writing module 703 can further include:
3rd judging submodule 7031, for corresponding with name information according to the name information in excel forms Value information judges xml types, if string types, then will be name information corresponding value information permutation write xml literary In part, if string-array types, then read the child node name information of name information, and by child node name information and The corresponding value information of child node name information writes xml document.
In the present embodiment, will be will convert into using a kind of file conversion device provided in Fig. 5 and embodiment illustrated in fig. 6 The xml document of excel is converted back again, is set up according to the value information in excel forms by creation module 701 first File, and xml document is created, then, the 3rd writing module 702 reads the NameSpace of excel form first cells Information, and xml document is write, last 4th writing module 703 will be the name information in excel forms corresponding with name information Value information according to the 3rd prepattern write xml document in, just realize the work(that excel files are converted into xml document Can, further solving in Android platform, existing technology does not possess Excel file is converted into android system institute The technical problem of the xml document of form is required, meanwhile, as the user of Android system is more and more, meet present The demand of Android system user, greatly extends economic market.
Those skilled in the art can be understood that, for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, may be referred to the corresponding process in preceding method embodiment, will not be described here.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method can be with Realize by another way.For example, device embodiment described above is only schematic, for example, the unit Divide, only a kind of division of logic function can have other dividing mode, such as multiple units or component when actually realizing Can with reference to or be desirably integrated into another system, or some features can be ignored, or not perform.It is another, it is shown or The coupling each other for discussing or direct-coupling or communication connection can be the indirect couplings by some interfaces, device or unit Close or communicate to connect, can be electrical, mechanical or other forms.
The unit as separating component explanation can be or may not be it is physically separate, it is aobvious as unit The part for showing can be or may not be physical location, you can local to be located at one, or can also be distributed to multiple On NE.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme 's.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list Unit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized and as independent production marketing or use using in the form of SFU software functional unit When, can be stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially The part for contributing to prior art in other words or all or part of the technical scheme can be in the form of software products Embody, the computer software product is stored in a storage medium, use so that a computer including some instructions Equipment(Can be personal computer, server, or network equipment etc.)Perform the complete of each embodiment methods described of the invention Portion or part steps.And aforesaid storage medium includes:USB flash disk, portable hard drive, read only memory(ROM, Read-Only Memory), random access memory(RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
The above, above example only to illustrate technical scheme, rather than a limitation;Although with reference to front State embodiment to be described in detail the present invention, it will be understood by those within the art that:Which still can be to front State the technical scheme described in each embodiment to modify, or equivalent is carried out to which part technical characteristic;And these Modification is replaced, and does not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (6)

1. a kind of document conversion method, it is characterised in that include:
S1:Search xml document, and the most xml document of node is extracted for the first xml document;
S2:First xml document is write according to the first prepattern according to the name information of first xml document In excel forms;
S3:Non- first xml document is write into the excel according to the second prepattern related to non-first xml document In form, and process is merged to identical node;
S4:The life of first xml document and non-first xml document is preserved in the excel forms first cell Name space information.
2. method according to claim 1, it is characterised in that step S2 is specifically included:
S21:Judge the first xml document type, if the first xml document type is string, execution step S22, If the first xml document type is string-array, execution step S23;
S22:The name information of first xml document is write into the excel forms first row, value information write into The excel forms secondary series;
S23:The name information of first xml document is write into the excel forms first row, from the excel forms 3rd row start, and the child node name information of first xml document and the value information are write successively.
3. method according to claim 1, it is characterised in that step S3 is specifically included:
S31:Judge the non-first xml document type, if the non-first xml document type is string, execution step S32, the non-first xml document type are string-array, then execution step S33;
S32:Search in the excel forms whether it is existing with described in the non-first xml document name information identicals Name information, if so, then writes the value information corresponding with the non-first xml document name information, if it is not, then by institute State non-first xml document name information described excel forms last column is write with the value information, and to identical section Point carries out merging treatment;
S33:Search in the excel forms whether existing with the non-first xml document child node name information identical The name information, if so, then matches to the name information and quantity of the child node, if it is not, then by described non-first The child node name information of xml document writes described excel forms last column with value information, and to identical section Point carries out merging treatment.
4. a kind of file conversion device, it is characterised in that include:
Extraction module, for searching for xml document, and extracts the most xml document of node for the first xml document;
First writing module, for the name information according to first xml document according to the first prepattern by described first In xml document write excel forms;
Second writing module, for according to second prepattern related to non-first xml document by non-first xml document Write in the excel forms, and process is merged to identical node;
Attribute module, for preserving first xml document and described non-first in the excel forms first cell The namespace information of xml document.
5. file conversion device according to claim 4, it is characterised in that the first writing module is specifically included:
First judging submodule, for judging the first xml document type, if the first xml document type is string, Then triggering first writes submodule, if the first xml document type is string-array, triggering second writes submodule Block;
The first write submodule, for the name information of first xml document is write into the excel forms first Row, value information are write into the excel forms secondary series;
The second write submodule, for the name information of first xml document is write into the excel forms first Row, from the beginning of the excel forms the 3rd row, by the child node name information of first xml document and the value information Write successively.
6. file conversion device according to claim 4, it is characterised in that the second writing module is specifically included:
Second judging submodule, for judging the non-first xml document type, if the non-first xml document type is String, then triggering the 3rd write submodule, and the non-first xml document type is string-array, then triggering the 4th is write Enter submodule;
The 3rd write submodule, it is whether existing with non-first xml document for searching in the excel forms Name information described in name information identicals, if so, then writes corresponding with the non-first xml document name information Value information, if it is not, the non-first xml document name information is write the excel forms with the value information then Last column, and process is merged to identical node;
The 4th write submodule, it is whether existing sub with non-first xml document in the excel forms for searching for Name information described in node name information identicals, if so, then matches to the name information and quantity of the child node, if It is no, then the child node name information of non-first xml document and value information are write into the excel forms last A line, and process is merged to identical node.
CN201410038983.8A 2014-01-26 2014-01-26 A kind of document conversion method and device Active CN103729339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410038983.8A CN103729339B (en) 2014-01-26 2014-01-26 A kind of document conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410038983.8A CN103729339B (en) 2014-01-26 2014-01-26 A kind of document conversion method and device

Publications (2)

Publication Number Publication Date
CN103729339A CN103729339A (en) 2014-04-16
CN103729339B true CN103729339B (en) 2017-04-05

Family

ID=50453418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410038983.8A Active CN103729339B (en) 2014-01-26 2014-01-26 A kind of document conversion method and device

Country Status (1)

Country Link
CN (1) CN103729339B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7188304B2 (en) * 2002-04-16 2007-03-06 Fujitsu Limited Conversion processing system of character information
CN101751461A (en) * 2009-12-30 2010-06-23 中兴通讯股份有限公司 Document conversion method and device
CN101968783A (en) * 2010-09-19 2011-02-09 深圳市万兴软件有限公司 Method and device of converting XML document into Excel document

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101055577A (en) * 2006-04-12 2007-10-17 龙搜(北京)科技有限公司 Collector capable of extending markup language

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7188304B2 (en) * 2002-04-16 2007-03-06 Fujitsu Limited Conversion processing system of character information
CN101751461A (en) * 2009-12-30 2010-06-23 中兴通讯股份有限公司 Document conversion method and device
CN101968783A (en) * 2010-09-19 2011-02-09 深圳市万兴软件有限公司 Method and device of converting XML document into Excel document

Also Published As

Publication number Publication date
CN103729339A (en) 2014-04-16

Similar Documents

Publication Publication Date Title
Hoel The supply side of CO2 with country heterogeneity
CN102870116B (en) Method and apparatus for content matching
CN107193805A (en) Article Valuation Method, device and storage medium based on artificial intelligence
CN107506193A (en) A kind of development approach of subsystem page, storage medium and server
CN105761139A (en) Account checking system and method
CN107563193A (en) Access and control strategy of database method and system based on SQL templates
US20170228356A1 (en) System Generator Module for Electronic Document and Electronic File
CN105022740A (en) Processing method and device of unstructured data
CN106528896B (en) A kind of database optimizing method and device
CN107329765A (en) Program file processing method and processing device
CN107103035A (en) This earth's surface data-updating method and device
CN104090995B (en) The automatic generation method of rebar unit grids in a kind of ABAQUS tire models
CN104572744A (en) Structured document generating method and device
WO2011074942A1 (en) System and method of converting data from a multiple table structure into an edoc format
CN103729339B (en) A kind of document conversion method and device
CN103631714A (en) Method for generating minimum combination testing cases based on matrix multiplicity
CN103902275A (en) Method and system for achieving conversion of language versions of applications
CN109614457B (en) Deep learning-based geographic information identification method and device
CN101295245B (en) Intelligent extracting method based on model information
CN105224317B (en) A kind of APK is applied to the method and system in Android project source code
CN107092474A (en) Program developing method, ETL processing method and processing devices
CN103377187A (en) Method, device and program for paragraph segmentation
CN102663041B (en) Automatic extraction method oriented to data of deep web pages
CN106569986A (en) Character string replacement method and device
CN112668292B (en) Method for automatically extracting tracking matrix from system configuration rule and application thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant