CN106557568A - The processing method that the XML file format of pattern match is changed with relational database - Google Patents

The processing method that the XML file format of pattern match is changed with relational database Download PDF

Info

Publication number
CN106557568A
CN106557568A CN201611029423.1A CN201611029423A CN106557568A CN 106557568 A CN106557568 A CN 106557568A CN 201611029423 A CN201611029423 A CN 201611029423A CN 106557568 A CN106557568 A CN 106557568A
Authority
CN
China
Prior art keywords
data
xml file
pattern
node
xml
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.)
Granted
Application number
CN201611029423.1A
Other languages
Chinese (zh)
Other versions
CN106557568B (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.)
CETC 28 Research Institute
Original Assignee
CETC 28 Research Institute
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 CETC 28 Research Institute filed Critical CETC 28 Research Institute
Priority to CN201611029423.1A priority Critical patent/CN106557568B/en
Publication of CN106557568A publication Critical patent/CN106557568A/en
Application granted granted Critical
Publication of CN106557568B publication Critical patent/CN106557568B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses the processing method that the XML file format of pattern match is changed with relational database, including:Step 1, by analyzing XML file format, identifies the data pattern in XML file, is written as data pattern configuration file;Step 2, reads and parses XML file, and which is matched with the data pattern in data pattern configuration file, forms the data structure of tree-shaped, identifies data item;Data item, using the data item of identification, is converted to corresponding database table and Database field by step 3, is assembled into SQL statement, and the conversion of XML file and relational database is realized in complete paired data operation.

Description

The processing method that the XML file format of pattern match is changed with relational database
Technical field
The invention belongs to microcomputer data processing field, the present invention is the XML file format and relation of pattern match The processing method of database conversion.
Background technology
Extensible markup language (eXtensible Markup Language, XML) is although as a kind of computer technology It is very simple on surface, but computer software, the broad applicability of data base administration and B2B Communications Worlds and profound influence are made People is surprised.This extensible language based on mark provides powerful function, not only can provide a kind of height to build data Structuring and easy-to-handle mode, and can store, exchange information with regard to data sense, it is that cross-platform information is handed over The main path for changing.
Data exchange to be carried out using XML, first have to solve the problems, such as the parsing of XML document, its semanteme is clearly solved Read.The member of W3C and XML_DEV mail tabulations proposes the application programming interfaces of two standards respectively:DOM(Document Object Model, DOM Document Object Model) and SAX (Simple API for XML, XML simple programming interfaces), its main reality The access interface to XML file is showed, data conversion mechanism is not provided.Further to realize that the identifying processing of data field is needed Source code to be write for each data item to be identified processing, for the renewal operation of data-interface needs repairing for source code level Change, lack flexibility.
In existing XML and relational database conversion implementation method, be essentially all based on the DTD in XML file and (DTD and XML Schema are for entering row constraint, the structure for determining XML document, element and category to XML document to XML Schema The title and type of property) realize data conversion, but be in most cases no XML in XML interface file in reality Schema's and DTD.(Hu Hua, Shao Jun, based on the research of XML relational databases switching strategy and realization. microcomputer information .2008.24(5-3))
XED (XML-Enabled DBMS) is that XML support modules are extended on the basis of legacy data storehouse, completes XML numbers According to form conversion and transmission and database between, the mapping method of " based on list " is usually used.XML document is regarded as by it One list or a set of list.That is the structure of XML document must comply with the structure specified, if XML document does not have When following the tactical rule, this mapping is unavailable.(Ma Ming, XML database Preliminary exploration. computer and telecommunications .2011.)
The content of the invention
It is an object of the invention to provide the processing method that the XML file format of pattern match is changed with relational database, The mapping treatment method from XML file to database table is realized, when XML file interface is expanded, it is only necessary to match somebody with somebody by modification The dissection process to new interface content is completed by putting.
Realize that the object of the invention technical solution is:A kind of XML format of pattern match and relational database conversion Processing method, the present invention are comprised the following steps:
Data in XML file, by analyzing XML file format, are divided into by step 1 according to the difference of Method of Data Organization Four class data groups, according to the nodename and Method of Data Organization of XML file, describe it as four class data patterns, and store In mode configuration file;
Step 2, reads and parses XML file, which is matched with the data pattern in data pattern configuration file, shape Into with the one-to-one internal storage data of data item in data pattern;
Step 3, according to the corresponding relation of data item in internal storage data and data pattern, by internal storage data and correspondence database Field is corresponded, and is assembled into SQL statement, and the conversion of XML file and relational database is realized in the operation of database.
Step 1 comprises the steps:
Step 1-1, analyzes the data form of XML file, and according to the difference of Method of Data Organization, (nodename is different, section Logical relation between point is different) data in XML file are divided into into four class data groups, including:
Primary sources group, is a group profile element of whole XML file, higher level's section of each leaf node in the data group Point is no child node under root node, and its node, and only occurs once in whole XML file;
Secondary sources group, at most only occurs once in XML file, in the case that in the data group, minor matters point is A, The superior node of minor matters point A is root node, then minor matters point A only occurs once or occurs without, all leaf nodes of its child node;
3rd class data group, is have identical structure in XML file, and data group more than twice occurs, in the number In the case of being B1 according to minor matters point in group, the superior node of minor matters point B1 is root node, and once or not going out only occurs in minor matters point B1 Existing, its child node is to may occur in which minor matters point B2 more than twice, then all leaf nodes of child node of minor matters point B2;
4th class data group, is have identical structure in XML file, and data group more than twice occurs, in the number In the case of being C according to minor matters point in group, the superior node of minor matters point C is root node, does not include minor matters point and leaf segment in minor matters point C Point, minor matters point C is allowed to be occurred more than twice or occurs without, and minor matters point C includes plural attribute;
In above-mentioned four classes data pattern, the root node of each node and each branch nodename do not repeat.In addition to the first kind, other Three classes can include multi-group data in same data file and not affect procedure identification by changing concept transfer title, because This can use the method expanding data interactive interface.
Four class data groups are defined as four class data patterns, and are specifically described per class data by configuration file by step 1-2 Pattern, each data pattern include node path name, corresponding database user name, password, table name, database key, data The corresponding Database field name of storehouse unique key, database manipulation strategy and each data item, field type and field length, use To support the identification to XML file content.
Step 2 of the present invention comprises the steps:
Step 2-1, (is typically set to 4000 bytes, because of ORACLE as length of element using the maximum length of each field Largest field is held for 4000 bytes), the data item maximum number that can be included with the data pattern in data pattern configuration file is as unit Plain number (being generally designated as 64), defines two-dimensional array;
Step 2-2, the data pattern configuration file that read step 1-2 is generated form data pattern structure tree in internal memory;
Step 2-3, reads XML file, and XML structure tree is formed in internal memory;
Step 2-4, by step 2-3 generate XML structure tree in each nodename and to root node fullpath and Matched according to all data patterns in the data pattern structure tree that step 2-2 is generated, found out the XML knots with pattern match Data group in paper mulberry.If the data pattern for matching, execution step 2-5;Terminate if the data pattern not matched Parsing.
Step 2-5, the two-dimensional array dynamic application internal memory defined using step 2-1, and with 0 initialization internal memory, for depositing The data result that storage is parsed from XML file.Will be the internal memory of application attached if the parsing data of existing identical data pattern Behind upper one group of data, data link table is formed;If it does not exist, then as the head node of chained list.
Step 2-6, by each leaf node title in the data group in the XML structure tree found out in step 2-4 with match Data pattern in each data item title contrasted, if name-matches, by string data value according to data pattern Middle data item is stored sequentially in the two-dimensional array of step 2-5 generation;The data value is abandoned if it can not find occurrence.Circulation The data group no data item until in XML structure tree is compared, step 2-4 is jumped to.
Step 3 comprises the steps:
Step 3-1, analysis result data and corresponding data pattern that circular test step 2-6 is generated, judges data mould Whether formula needs to delete data with existing.If necessary to delete data with existing, in the data link table generated from step 2-6, deletion is found out Corresponding data value is operated, duplicate keys are rejected, and the conditional statement of (DELETE) sentence is deleted as SQL;If need not delete Data with existing, direct execution step 3-2;
Step 3-2, judges whether corresponding data pattern is configured with unique key.If being configured with unique key, from step 2-6 The corresponding data value of unique key is found out in the analysis result data of generation and SQL query statement is converted to, inquiry is with the presence or absence of only One key colliding data, if unique key conflict, generates renewal (UPDATE) sentence of SQL according to unique key as conditional statement, Perform data and update operation, if unique key does not conflict, execution step 3-3;If not configuring unique key, direct execution step 3- 3;
Step 3-3, judges whether the corresponding data pattern of analysis result data is configured with major key, if being configured with major key, Corresponding data value is found out in the analysis result data generated from step 2-6 and SQL query statement is converted to, inquiry whether there is Major key colliding data, if there is major key conflict, generates renewal (UPDATE) sentence of SQL according to major key as conditional statement, Perform data and update operation;If major key does not conflict, insertion (INSERT) the sentence insertion data of SQL are generated;If do not configured Major key, generates insertion (INSERT) the sentence insertion data of SQL.
Step 3-4, if there is the analysis result data for not having to process, jumps to step 3-1;Otherwise terminate to process.
Beneficial effect:
XML format file content can be converted directly into database SQL sentence by the inventive method, realize database data Write operation.The principle of Land use models of the present invention matching, by it is common XML format data organizational form abstract be four class data Pattern, builds the contrast relationship of the data pattern and data item, and data item is converted directly into corresponding Database field, and raw Into database SQL sentence, can immediate operand according to storehouse.Data pattern is stored in the data file, can be changed at any time, be expanded.This When invention solves the problems, such as that XML file interface changes, data analysis software needs adaptation, in modification, expands During XML interface, it is only necessary to the dissection process of new data interface is supported by changing schema file.
Description of the drawings
With reference to the accompanying drawings and detailed description the present invention is done and is further illustrated, the present invention's is above-mentioned And/or otherwise advantage will become apparent.
Fig. 1 is the XML format data sample that the present invention is processed.
Fig. 2 is XML data group mode schematic diagram of the present invention.
Fig. 3 is that XML data group mode of the present invention describes file.
Fig. 4 is the tree form data structure schematic diagram for being formed in internal memory after XML is parsed by contrasting data pattern of the present invention again.
Fig. 5 is the handling process of the XML parsings of the present invention.
Fig. 6 is the data loading handling process of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawings the present invention is illustrated.It is noted that described embodiment merely to explanation Purpose, rather than limitation of the scope of the invention.
The present invention is comprised the following steps:
Data in XML file, by analyzing XML file format, are divided into by step 1 according to the difference of Method of Data Organization Four class data groups, according to the nodename and Method of Data Organization of XML file, are written as data pattern configuration file;
Step 2, reads and parses XML file, which is matched with the data pattern in data pattern configuration file, shape Into with the one-to-one internal storage data of data item in data pattern;
Step 3, according to the corresponding relation of data item in internal storage data and data pattern, by internal storage data and correspondence database Field is corresponded, and is assembled into SQL statement, and the conversion of XML file and relational database is realized in the operation of database.
Step 1 comprises the steps:
Step 1-1, analyzes the data form of XML file, and according to the difference of Method of Data Organization, (nodename is different, section Logical relation between point is different) data in XML file are divided into into four class data groups, including:
Primary sources group, is a group profile element of whole XML file, higher level's section of each leaf node in the data group Point is no child node under root node, and its node, only occurs once (first kind as shown in Figure 1) in whole XML file;
Secondary sources group, at most only occurs once in XML file, in the case that in the data group, minor matters point is A, The superior node of minor matters point A is root node, then minor matters point A only occurs once or occurs without, and all leaf nodes of its child node are (such as Equations of The Second Kind shown in Fig. 1);
3rd class data group, is have identical structure in XML file, and data group more than twice occurs, in the number In the case of being B1 according to minor matters point in group, the superior node of minor matters point B1 is root node, and once or not going out only occurs in minor matters point B1 Existing, its child node is to may occur in which minor matters point B2 more than twice, then all leaf nodes of child node of minor matters point B2 are (such as Fig. 1 institutes The 3rd class shown);
4th class data group, is have identical structure in XML file, and data group more than twice occurs, in the number In the case of being C according to minor matters point in group, the superior node of minor matters point C is root node, does not include minor matters point and leaf segment in minor matters point C Point, minor matters point C is allowed to be occurred more than twice or occurs without, and minor matters point C includes plural attribute (as shown in Figure 1 the 4th Class);
In above-mentioned four classes data pattern, the root node of each node and each branch nodename do not repeat.In addition to the first kind, other Three classes can include multi-group data in same data file and not affect procedure identification by changing concept transfer title, because This can use the method expanding data interactive interface.
Step 1-2,
Four class data groups are defined as into four class data patterns, and are specifically described per class data pattern, often by configuration file One data pattern includes node path name, and corresponding database user name, password, table name, database key, database are unique Key, database manipulation strategy (whether delete data with existing, which field to delete data with existing according to) and each data item pair Database field name, field type and the field length answered, for supporting the identification to XML file content.
Step 2 comprises the steps:
Step 2-1, (can be set to 4000 bytes, because ORACLE support as length of element using the maximum length of each field Largest field is 4000 bytes), (64 are can be designed to) as element number with the data item maximum number that data pattern can be included, defined Two-dimensional array;
Step 2-2, the data pattern configuration file that read step 1-2 is generated form data pattern structure tree in internal memory;
Step 2-3, reads XML file, and XML structure tree is formed in internal memory;
Step 2-4, by step 2-3 generate XML structure tree in each nodename and to root node fullpath and Matched according to all data patterns in the data pattern structure tree that step 2-2 is generated, found out the XML knots with pattern match Data group in paper mulberry.If the data pattern for matching, execution step 2-5;Terminate if the data pattern not matched Parsing.
Step 2-5, the two-dimensional array dynamic application internal memory defined using step 2-1, and with 0 initialization internal memory, for depositing The data result that storage is parsed from XML file.Will be the internal memory of application attached if the parsing data of existing identical data pattern Behind upper one group of data, data link table is formed.Form internal storage data tree similar to Figure 4;
Step 2-6, by each leaf node title in the data group in the XML structure tree found out in step 2-4 with match Data pattern in each data item title contrasted, if name-matches, by string data value according to data pattern Middle data item order (as shown in Figure 2) is stored in the two-dimensional array of step 2-5 generation;This is abandoned if it can not find occurrence Data value.Recycle ratio is to up to the data group no data item in XML structure tree.Jump to step 2-4.
Step 3 comprises the steps:
Step 3-1, judges whether the data item for recognizing is configured with delete key, if be configured with, from the number that step 2-3 is generated According to the corresponding data value of all delete keys is found out in chained list, duplicate keys are rejected, as the conditional statement of SQL cancel statements.For example With reference to Fig. 1 and Fig. 3, according to [information system interactive interface. equipment state] in the SQL cancel statements of deletion bond formed that configure For:
DELETE FROM DB_TABLE4WHERE
ZBRQ=TO_DATE (' 2015-10-01', ' yyyy-mm-dd') AND SBDW='XX units ';
After execution, the data with existing of the same day unit phase same date is deleted.
Step 3-2, judges whether the data item for recognizing is configured with unique key, if be configured with, from the number that step 2-6 is generated SQL query statement is respectively converted into according to corresponding every group of data conversion is found out in chained list, inquiry is with the presence or absence of unique key conflict Data, if conflict, generate the UPDATE statement of SQL according to unique key as conditional statement.Fig. 1 and Fig. 3 is combined for example, according to [information system interactive interface. equipment state] in configuration unique key, the first data formed SQL query statement be:
SELECT COUNT (*) FROM DB_TABLE4WHERE ID=' DDDD0001 ';
If backspace value>0, then perform
UPDATE DB_TABLE4SET MC=' routers ', ZT=' is normal ', SL=10,
ZBRQ=TO_DATE (' 2015-10-01', ' yyyy-mm-dd'), SBDW='XX units ' WHERE
ID=' DDDD0001 ';
Step 3-3, judges whether the data item for recognizing is configured with major key, if be configured with, from the data that step 2-6 is generated Corresponding every group of data conversion is found out in chained list and is respectively converted into SQL query statement, inquiry whether there is major key colliding data, If conflict, the UPDATE statement of SQL is generated as conditional statement according to major key.Fig. 1 and Fig. 3 is combined for example, according to [information system System interactive interface. equipment state] in configuration major key, the first data formed SQL query statement be:
SELECT COUNT (*) FROM DB_TABLE4WHERE ID=' DDDD0001 ';
If backspace value>0, then perform
UPDATE DB_TABLE4SET SL=10, ID=' DDDD0001 ' WHERE MC=' routers '
AND ZT=' are normal ' AND ZBRQ=TO_DATE (' 2015-10-01', ' yyyy-mm-dd') AND
SBDW='XX units ';
Data insertion sentence is generated otherwise:
INSERT INTO DB_TABLE4 (MC, ZT, SL, ID, RQ, SBDW) VALUES (' routers ', ' normal ', 10, ' DDDD0001 ', TO_DATE (' 2015-10-01', ' yyyy-mm-dd'), ' XX units ');
Embodiment
Shown in Figure 1, the XML format data sample that the example is commonly used in illustrating information system interaction therefrom can be taken out It is as follows as going out the common data packet patterns of four classes:
The first kind, is one group profile element of whole XML file, it is characterized in that the superior node of each leaf node is root section No child node under point, and its node, only occurs once (first kind as shown in Figure 1) in whole XML file;
Equations of The Second Kind, is one group of data group at most only occurring once in XML file, it is characterized in that minor matters point (being assumed to be A) Superior node be root node, minor matters point A only occurs once or occurs without, and all leaf nodes of its child node are (as shown in Figure 1 Equations of The Second Kind);
3rd class, is have identical structure in XML file, and the data group that repeatedly can occur is characterized in that minor matters point is (false Be set to B1) superior node be root node, minor matters point B1 only occurs once or occurs without, and its child node is to may occur in which multiple branch Node (is assumed to be B2), all leaf nodes of child node (the 3rd class as shown in Figure 1) of B2;
4th class, is have identical structure in XML file, and the data group that repeatedly can occur is characterized in that minor matters point is (false Be set to C) superior node be root node, do not include minor matters point and leaf node in minor matters point C, minor matters point C allow to occur twice with Go up or occur without, minor matters point C includes multiple attributes (the 4th class as shown in Figure 1);
The root node of wherein each node, each branch nodename can not repeat.
It is shown in Figure 2, according to above-mentioned classification, using the example file shown in Fig. 1, form XML data group mode.Figure In (0), (1), (2), (3) represent four kinds of patterns respectively.Wherein pattern (0) is directly pertaining to root node because of which, thus per class There can only be one group of data in interface document, element entry can be increased;Pattern (1), (2), (3) arbitrarily can be expanded, and increase multiple Data group, facilitates software interface to expand.
It is shown in Figure 3 to describe file for XML data pattern.The feature of four class group modes is specifically retouched by this document State, will be a data group corresponding with database table, by each data item and Database field name, field type, data length phase Correspondence, and the information such as the major key of descriptive data base table, unique key.
XML data group mode is described in file in figure 3, is described respectively each to relation according to database table The corresponding database table of the corresponding Database field of data item, field length, data type and each data classification, user Name, password, major key, unique key.
Wherein, under [information system interactive interface data pattern] it is the corresponding XML file root node name supported, can order Increase the XML file root node name for needing to support;
It is the packet that includes in the first kind root node supported under [information system interactive interface], it is intended that packet Type and group names, can arbitrarily increase pattern (1), (2), the packet of (3) class;
It is the corresponding parameter information of each packet under [information system interactive interface .XXXX], including packet pair Answer the user name of database, password, show, major key, unique key, the corresponding data field name of data item, data type, data are long Degree.
It is shown in Figure 5, it is the tree data knot formed in internal memory after XML is parsed by contrasting data pattern of the present invention Structure.As XML file content is tree-like hierarchical structure, recurrence relation, the whole tree construction of recursive traversal, profit are logically there are Matched with mode packet file with the fullpath of each node, the tree structure of whole XML, each number are generated in internal memory It is consistent to describe in file with the data packet patterns of Fig. 3 according to the order of item.
To solve, data item type is inconsistent, length inconsistence problems, and all field lengths in internal memory are defined as enough (defined in ORACLE, each field length is 4000 bytes to the character string dimension of big equal length, therefore defines the length and be 4000 bytes), all data are expressed as character types, are only matched somebody with somebody according to different data item when SQL statement is spliced The data type conversion put is into different real data types.
It is shown in Figure 5, it is the handling process of XML parsings of the present invention.
It is shown in Figure 6, it is the handling process that data loading operation how is completed after XML is parsed by the present invention.
It is for tree-like memory data structure is resolved to, unique key and database user name first according to configuration, close Code, table name generate query statement, find out database with the presence or absence of identical data, judge this operation be whether to legacy data more It is new to operate, if database has had the data of identical unique key, update other data fields;If there is no it is identical only The data of one key, then search whether there is identical data according still further to major key, if there is other data fields are then updated, if not There is the SQL statement for then generating insertion operation, and perform.
Above-mentioned process address only the increasing of data, change operation, for data deletion action, exist before 1) two kinds of situations delete The data for once reporting;2) this reported data some records fewer than last reported data.
For the first situation, need special definition delete processing interface, and it is actually used in be seldom related to, here is neglected Slightly;
For second situation, can describe file in XML data group mode increases " delete key " configuration item, data loading Before, data content that " delete key " data item data value differs is found out from such data for receiving as deletion condition, The SQL statement for deleting data is generated, aforementioned data warehouse-in process is then repeated again, is realized that data update operation.For example exist In Fig. 3 [information system interactive interface. equipment state] under " delete key " be configured to 5, then according to " date " delete.Assume first Secondary reported data title is recorded comprising 4, and second reported data is only recorded comprising 3, finds out " day first from current data Phase " different data item, performs deletion action, then all puts same day reported data in storage.

Claims (4)

1. the processing method that the XML file format of pattern match is changed with relational database, it is characterised in that including following step Suddenly:
Data in XML file, by analyzing XML file format, are divided into four classes according to the difference of Method of Data Organization by step 1 Data group, according to the nodename and Method of Data Organization of XML file, describes it as four class data patterns, and is stored in mould In formula configuration file;
Step 2, reads and parses XML file, and which is matched with the data pattern in data pattern configuration file, formed with The one-to-one internal storage data of data item in data pattern;
Step 3, according to the corresponding relation of data item in internal storage data and data pattern, by internal storage data and correspondence database field Correspond, be assembled into SQL statement, the conversion of XML file and relational database is realized in the operation of database.
2. method according to claim 1, it is characterised in that step 1 comprises the steps:
Step 1-1, analyzes the data form of XML file, is divided into the data in XML file according to the difference of Method of Data Organization Four class data groups, including:
Primary sources group, is a group profile element of whole XML file, and in the data group, the superior node of each leaf node is No child node under root node, and its node, and only occur once in whole XML file;
Secondary sources group, at most only occurs once in XML file, in the case that in the data group, minor matters point is A, minor matters The superior node of point A is root node, then minor matters point A only occurs once or occurs without, all leaf nodes of its child node;
3rd class data group, is have identical structure in XML file, and data group more than twice occurs, in the data group In the case that middle minor matters point is B1, the superior node of minor matters point B1 is root node, and minor matters point B1 only occurs once or occurs without, its Child node is to may occur in which minor matters point B2 more than twice, then all leaf nodes of child node of minor matters point B2;
4th class data group, is have identical structure in XML file, and data group more than twice occurs, in the data group In the case that middle minor matters point is C, the superior node of minor matters point C is root node, does not include minor matters point and leaf node in minor matters point C, Minor matters point C is allowed to be occurred more than twice or occurs without, and minor matters point C includes plural attribute;
In above-mentioned four classes data group, the root node of each node and each branch nodename do not repeat;
Four class data groups are defined as four class data patterns, and are specifically described per class data mould by configuration file by step 1-2 Formula, each data pattern include node path name, corresponding database user name, password, table name, database key, database The corresponding Database field name of unique key, database manipulation strategy and each data item, field type and field length.
3. method according to claim 2, it is characterised in that step 2 comprises the steps:
Step 2-1, using the maximum length of each field as length of element, can with the data pattern in data pattern configuration file Comprising data item maximum number be element number, define two-dimensional array;
Step 2-2, the data pattern configuration file that read step 1-2 is generated form data pattern structure tree in internal memory;
Step 2-3, reads XML file, and XML structure tree is formed in internal memory;
Step 2-4, by step 2-3 generate XML structure tree in each nodename and to root node fullpath and according to All data patterns in the data pattern structure tree that step 2-2 is generated are matched, and find out the XML structure tree with pattern match In data group, if match data pattern, execution step 2-5;Terminate parsing if the data pattern not matched;
Step 2-5, using step 2-1 define two-dimensional array dynamic application internal memory, and with 0 initialize internal memory, for store from The internal memory of application is attached to if the parsing data of existing identical data pattern by the data result parsed in XML file Behind one group of data, data link table is formed;If it does not exist, then as the head node of chained list;
Step 2-6, by each leaf node title in the data group in the XML structure tree found out in step 2-4 and the number for matching Each data item title according to pattern is contrasted, if name-matches, by string data value according to number in data pattern It is stored sequentially in the two-dimensional array of step 2-5 generation according to item;The data value, recycle ratio pair are abandoned if it can not find occurrence Until the data group no data item in XML structure tree, jumps to step 2-4.
4. method according to claim 3, it is characterised in that step 3 comprises the steps:
Step 3-1, analysis result data and corresponding data pattern that circular test step 2-6 is generated, judges that data pattern is It is no to need to delete data with existing, if necessary to delete data with existing, in the data link table generated from step 2-6, find out deletion action Corresponding data value, rejects duplicate keys, deletes the conditional statement of DELETE sentences as SQL, performs SQL statement and deletes several According to execution step 3-2;If data with existing need not be deleted, direct execution step 3-2;
Step 3-2, judges whether corresponding data pattern is configured with unique key, if being configured with unique key, generates from step 2-6 Analysis result data in find out the corresponding data value of unique key and be converted to SQL query statement, inquiry is with the presence or absence of unique key Colliding data, if there is unique key conflict, generates the renewal UPDATE statement of SQL according to unique key, holds as conditional statement Row data update operation, if unique key does not conflict, execution step 3-3;If not configuring unique key, direct execution step 3-3;
Step 3-3, judges whether the corresponding data pattern of analysis result data is configured with major key, if being configured with major key, from step Corresponding data value is found out in the analysis result data that rapid 2-6 is generated and SQL query statement is converted to, inquiry is with the presence or absence of major key Colliding data, if there is major key conflict, generates the renewal UPDATE statement of SQL according to major key, performs number as conditional statement Operate according to updating;If major key does not conflict, the insertion INSERT sentences insertion data of SQL are generated;If not configuring major key, generate The insertion INSERT sentences insertion data of SQL;
Step 3-4, if there is the analysis result data for not having to process, jumps to step 3-1, otherwise terminates to process.
CN201611029423.1A 2016-11-14 2016-11-14 The processing method of XML file format and the relational database conversion of pattern match Active CN106557568B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611029423.1A CN106557568B (en) 2016-11-14 2016-11-14 The processing method of XML file format and the relational database conversion of pattern match

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611029423.1A CN106557568B (en) 2016-11-14 2016-11-14 The processing method of XML file format and the relational database conversion of pattern match

Publications (2)

Publication Number Publication Date
CN106557568A true CN106557568A (en) 2017-04-05
CN106557568B CN106557568B (en) 2019-05-21

Family

ID=58444389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611029423.1A Active CN106557568B (en) 2016-11-14 2016-11-14 The processing method of XML file format and the relational database conversion of pattern match

Country Status (1)

Country Link
CN (1) CN106557568B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334621A (en) * 2018-02-08 2018-07-27 平安科技(深圳)有限公司 Database operation method, device, equipment and computer readable storage medium
CN109885569A (en) * 2018-12-29 2019-06-14 天津南大通用数据技术股份有限公司 Field extraction and structural method are carried out to XML data based on configuration file
CN110806999A (en) * 2018-07-19 2020-02-18 上海擎感智能科技有限公司 Method and device for managing CSV file
CN110851520A (en) * 2019-11-19 2020-02-28 中国银行股份有限公司 Data loading method and system
CN111177147A (en) * 2019-12-02 2020-05-19 北京亚信数据有限公司 Metadata batch warehousing method, readable storage medium and computing device
WO2020155784A1 (en) * 2019-01-31 2020-08-06 平安科技(深圳)有限公司 General-purpose data interface-based message storage method and apparatus, and computer device
CN111831572A (en) * 2020-07-24 2020-10-27 北京思特奇信息技术股份有限公司 Batch comparison test method and device for realizing XML-JSON
CN111984826A (en) * 2020-09-02 2020-11-24 河北幸福消费金融股份有限公司 XML-based data automatic storage method, system, device and storage medium
CN112000332A (en) * 2020-07-09 2020-11-27 惠州市德赛西威汽车电子股份有限公司 Automatic generating method and system of bus panel
CN112182305A (en) * 2020-09-26 2021-01-05 广州鲁邦通物联网科技有限公司 XML (extensive markup language) analysis module and method based on XML rules and management method of configuration data
CN112000332B (en) * 2020-07-09 2024-05-31 惠州市德赛西威汽车电子股份有限公司 Automatic generation method and system of bus panel

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100162100A1 (en) * 2008-12-19 2010-06-24 International Business Machines Corporation System and method for exporting data to web-based applications
CN102760164A (en) * 2012-06-12 2012-10-31 上海方正数字出版技术有限公司 Method for exchanging data between relation database management system and XML (Extensive Makeup Language) database management system
CN104428764A (en) * 2012-06-29 2015-03-18 汤姆森路透社全球资源公司 Systems, methods, and software for processing, presenting, and recommending citations
CN104572894A (en) * 2014-12-24 2015-04-29 天津南大通用数据技术股份有限公司 Method for describing service model by utilizing XML (Extensible Markup Language) in business intelligence and business intelligence system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100162100A1 (en) * 2008-12-19 2010-06-24 International Business Machines Corporation System and method for exporting data to web-based applications
CN102760164A (en) * 2012-06-12 2012-10-31 上海方正数字出版技术有限公司 Method for exchanging data between relation database management system and XML (Extensive Makeup Language) database management system
CN104428764A (en) * 2012-06-29 2015-03-18 汤姆森路透社全球资源公司 Systems, methods, and software for processing, presenting, and recommending citations
CN104572894A (en) * 2014-12-24 2015-04-29 天津南大通用数据技术股份有限公司 Method for describing service model by utilizing XML (Extensible Markup Language) in business intelligence and business intelligence system

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334621A (en) * 2018-02-08 2018-07-27 平安科技(深圳)有限公司 Database operation method, device, equipment and computer readable storage medium
CN110806999A (en) * 2018-07-19 2020-02-18 上海擎感智能科技有限公司 Method and device for managing CSV file
CN109885569A (en) * 2018-12-29 2019-06-14 天津南大通用数据技术股份有限公司 Field extraction and structural method are carried out to XML data based on configuration file
WO2020155784A1 (en) * 2019-01-31 2020-08-06 平安科技(深圳)有限公司 General-purpose data interface-based message storage method and apparatus, and computer device
CN110851520A (en) * 2019-11-19 2020-02-28 中国银行股份有限公司 Data loading method and system
CN111177147B (en) * 2019-12-02 2023-11-28 北京亚信数据有限公司 Metadata batch warehousing method, readable storage medium and computing device
CN111177147A (en) * 2019-12-02 2020-05-19 北京亚信数据有限公司 Metadata batch warehousing method, readable storage medium and computing device
CN112000332B (en) * 2020-07-09 2024-05-31 惠州市德赛西威汽车电子股份有限公司 Automatic generation method and system of bus panel
CN112000332A (en) * 2020-07-09 2020-11-27 惠州市德赛西威汽车电子股份有限公司 Automatic generating method and system of bus panel
CN111831572A (en) * 2020-07-24 2020-10-27 北京思特奇信息技术股份有限公司 Batch comparison test method and device for realizing XML-JSON
CN111984826B (en) * 2020-09-02 2023-11-10 河北幸福消费金融股份有限公司 XML-based data automatic warehousing method, system, device and storage medium
CN111984826A (en) * 2020-09-02 2020-11-24 河北幸福消费金融股份有限公司 XML-based data automatic storage method, system, device and storage medium
CN112182305A (en) * 2020-09-26 2021-01-05 广州鲁邦通物联网科技有限公司 XML (extensive markup language) analysis module and method based on XML rules and management method of configuration data

Also Published As

Publication number Publication date
CN106557568B (en) 2019-05-21

Similar Documents

Publication Publication Date Title
CN106557568B (en) The processing method of XML file format and the relational database conversion of pattern match
CA2551591C (en) Method and apparatus for processing xml tagged data
JP3754253B2 (en) Structured document search method, structured document search apparatus, and structured document search system
US6611843B1 (en) Specification of sub-elements and attributes in an XML sub-tree and method for extracting data values therefrom
US5303367A (en) Computer driven systems and methods for managing data which use two generic data elements and a single ordered file
US9197597B2 (en) RDF object type and reification in the database
CN105849726B (en) For efficiently supporting the general index of the extemporaneous inquiry by demixing marking data
Candel et al. A unified metamodel for NoSQL and relational databases
US7370270B2 (en) XML schema evolution
US7171427B2 (en) Methods of navigating a cube that is implemented as a relational object
US6636845B2 (en) Generating one or more XML documents from a single SQL query
US7493305B2 (en) Efficient queribility and manageability of an XML index with path subsetting
US20030120642A1 (en) Indexing, rewriting and efficient querying of relations referencing semistructured data
US9495475B2 (en) Method of representing an XML schema definition and data within a relational database management system using a reusable custom-defined nestable compound data type
US20090106286A1 (en) Method of Hybrid Searching for Extensible Markup Language (XML) Documents
US20030229610A1 (en) Simpler and more concise interface to relational databases
KR20010012305A (en) System and method for storing and manipulating data in an information handling system
CN107066551B (en) Row-type and column-type storage method and system for tree-shaped data
US20060161525A1 (en) Method and system for supporting structured aggregation operations on semi-structured data
US20060015809A1 (en) Structured-document management apparatus, search apparatus, storage method, search method and program
KR101244466B1 (en) Method for data modelling using NoSQL
CN104951565B (en) XM (extensible messaging client) L (extensible markup language) configuration maintenance method and system based on memory database
JP2006524376A (en) Generic database schema
JP2005190163A (en) Method, apparatus and program for retrieving structured data
US10108742B1 (en) Apparatus and method for data redaction in a semi-structured document database

Legal Events

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