CN106293862A - A kind of analysis method and device of expandable mark language XML data - Google Patents
A kind of analysis method and device of expandable mark language XML data Download PDFInfo
- Publication number
- CN106293862A CN106293862A CN201510357844.6A CN201510357844A CN106293862A CN 106293862 A CN106293862 A CN 106293862A CN 201510357844 A CN201510357844 A CN 201510357844A CN 106293862 A CN106293862 A CN 106293862A
- Authority
- CN
- China
- Prior art keywords
- node
- data
- xml data
- type
- configuration information
- 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
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention discloses the analysis method and device of a kind of XML data, it is possible to XML data is converted directly into business object, hence it is evident that improve analysis feature.The method comprises determining that the document object type of XML data to be resolved;From the node configuration information prestored, obtain the node configuration information corresponding with described document object type;Described node configuration information comprises: node diagnostic data and the data type of node;Each row of data in XML data is performed operations described below successively, until having resolved XML data: according to the node diagnostic data comprised in described node configuration information and the data type of node, determine node and the data type of described node that Current Datarow is corresponding;According to the data type of described node, described node is resolved, obtain the business object of described node;When root node during described node is not described XML data, the business object obtained is assigned to the business object of the father node of described node.
Description
Technical field
The present invention relates to Internet technical field, particularly relate to a kind of extensible markup language (Extensible
Markup Language, XML) analysis method and device of data.
Background technology
Extensible markup language (Extensible Markup Language, XML), standard generalized markup language
The subset of speech, a kind of makes it have structural markup language for labelling e-file.It can be used to mark
Numeration, according to, definition data type, is a kind of user of permission original language of being defined the markup language of oneself.
It is especially suitable for Internet transmission, it is provided that unified method describes and exchanges independent of application program or supply
The structural data of business.XML becomes the standard of data among systems information exchange with the feature of himself.
Under the language environment of Java (computer programming language), existing XML data analytic technique master
JDOM and DOM4J to be had etc..
Specifically, when using JDOM method to resolve XML data, the tool that resolver SAX performs
Body process of analysis is: the alphabet string in XML data is converted to document model object (document),
I.e. dom tree shape structure;Then the document model object after conversion is carried out sequential scan and traversing operation,
Finally give the business object of correspondence, such as element or element property values.Document model pair is resolved at SAX
During as, running into beginning and the end of document model object, the beginning of element all can be touched with the place terminated
Send out event handling function a series of, these functions complete to operate accordingly.
When using DOM4J method to resolve XML message, concrete process of analysis is similar with JDOM method,
Different, in DOM4J method, employ application programming interface (Application in a large number
Programming Interface, API) in Collections class, and also provide some alternative methods with
Obtain more preferable analysis feature or more direct coded system, can use in a lot of open source projects, such as
Hibernate。
Which kind of, it can be seen that no matter use process of analysis from above two process of analysis, first will be required to
In XML data, all character strings are converted to document model object, and are stored in internal memory, then if it is desired to
Obtain the business object needed, in addition it is also necessary to customized development converse routine, document model object is mapped to one by one
In business object.There is following defect in this method:
First, the document model object being converted to needs committed memory, and XML data is the biggest, accounts for
Internal memory the most, exist internal memory overflow risk;Secondly, in the case of XML data is bigger,
Use above-mentioned analytic method that analysis feature can be made seriously to reduce, time-consumingly can exponentially formula rise;Finally, customization
Exploitation converse routine needs to expend valuable human resources, and the quality developed also cannot be completely secured.
Summary of the invention
The embodiment of the present invention provides the analysis method and device of a kind of XML data, it is possible to by XML data
It is converted directly into business object, hence it is evident that improve analysis feature.
The embodiment of the present invention is by the following technical solutions:
Embodiments provide the analytic method of a kind of XML data, including:
Determine the document object type of XML data to be resolved;
From the node configuration information prestored, obtain the node configuration corresponding with described document object type
Information;Wherein, described node configuration information comprises: node diagnostic data and the data type of node;
Each row of data in described XML data is performed operations described below successively, until having resolved described XML
Data:
According to the node diagnostic data comprised in described node configuration information and the data type of node, determine and work as
Node that the data that move ahead are corresponding and the data type of described node;
According to the data type of described node, described node is resolved, obtain the business pair of described node
As;
When root node during described node is not described XML data, the business object obtained is assigned to
The business object of the father node of described node.
Wherein, according to the data type of described node, described node is resolved, obtain described node
Business object;
When the data type of described node is initial form, obtain the primitive class offset of described node, as
Business object for described node;
When the data type of described node is object type, create new business object for described node, make
Business object for described node.
Wherein it is determined that the document object type of XML data to be resolved, specifically include:
Judge whether described XML data carries document object type;
When judging described XML data carries document object type, described XML data is taken
The document object type of band is defined as the document object type of described XML data;
When judging described XML data does not carries document object type, by described XML data
The nodename of root node is defined as the document object type of described XML data.
Wherein, the nodename of the root node of described XML data is defined as the literary composition of described XML data
Shelves object type, specifically includes:
Determine the root node in described XML data;Wherein said root node is in described XML data
One node comprising beginning label and end mark;
The nodename of the root node of described XML data is defined as the document object of described XML data
Type.
Wherein it is determined that before the document object type of XML data to be resolved, described method also includes:
The node configuration information prestored is read from repository;
The node configuration information read is stored in the buffer according to the document object type of its correspondence;Then
From the node configuration information prestored, obtain the node configuration corresponding with described document object type
Information, specifically includes:
From prestoring node configuration information in the buffer, obtain corresponding with described document object type
Node configuration information.
Embodiments provide the resolver of a kind of XML data, including:
Document object type determining units, for determining the document object type of XML data to be resolved;
Node configuration information acquiring unit, for from the node configuration information prestored, obtains with described
The node configuration information that document object type that document object type determining units determines is corresponding;Wherein, described
Node configuration information comprises: node diagnostic data and the data type of node;
Resolution unit, for each row of data in described XML data is performed operations described below successively, until
Resolve described XML data:
According to the node diagnostic comprised in the node configuration information that described node configuration information acquiring unit obtains
Data and the data type of node, determine node and the data type of described node that Current Datarow is corresponding;
According to the data type of described node, described node is resolved, obtain the business object of described node;
When root node during described node is not described XML data, the business object obtained is assigned to described
The business object of the father node of node.
Wherein, described resolution unit, specifically for:
When the data type of described node is initial form, obtain the primitive class offset of described node, as
Business object for described node;
When the data type of described node is object type, create new business object for described node, make
Business object for described node.
Wherein, described document object type determining units, specifically include:
Judge module, is used for judging whether to carry in described XML data document object type;
First judged result module, for carrying in described judging unit judges described XML data
During document object type, the document object type described XML data carried is defined as described XML number
According to document object type;
Second judged result module, for not carrying in described judge module judges described XML data
During document object type, the nodename of the root node of described XML data is defined as described XML number
According to document object type.
Wherein, described second judged result module, specifically for:
Determine the root node in described XML data;Wherein said root node is in described XML data
One node comprising beginning label and end mark;Nodename by the root node of described XML data
It is defined as the document object type of described XML data.
Wherein, described device also includes:
Read unit, for reading the node configuration information prestored from repository;
Buffer unit, for the node configuration information that read by described reading unit according to the document pair of its correspondence
As type stores in the buffer;Then
Described node configuration information acquiring unit, specifically for:
From the node configuration information that described buffer unit prestores in the buffer, obtain and described document pair
As the node configuration information that type is corresponding.
Having the beneficial effect that of the embodiment of the present invention:
In the embodiment of the present invention, it is determined by the document object type of XML data to be resolved, according in advance
The document object type first stored and the corresponding relation of node configuration information, the document object class obtaining Yu determining
The node configuration information that type is corresponding, further according to the node diagnostic data that comprise in the node configuration information obtained and
The data type of node, and the business object of other node beyond the node that digs up the roots is assigned to its father node
The mode of business object, it is achieved the parsing to XML data to be resolved, compared with prior art, energy
Enough XML data is converted directly into business object, it is to avoid need to build document when traditional X-ray ML resolves
Model object is as intermediate object program thus easily causes the risk that internal memory overflows, and solves at parsing super large
Performance bottleneck during XML data, reduces the expense of Installed System Memory and CPU, makes analysis feature substantially carry
Rise.
Other features and advantages of the present invention will illustrate in the following description, and, partly from explanation
Book becomes apparent, or understands by implementing the present invention.The purpose of the present invention and other advantages can
Realize by structure specifically noted in the description write, claims and accompanying drawing and obtain
?.
Accompanying drawing explanation
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes of the present invention
Point, the schematic description and description of the present invention is used for explaining the present invention, is not intended that to the present invention not
Work as restriction.In the accompanying drawings:
The flowchart of the analytic method of a kind of XML data that Fig. 1 provides for the embodiment of the present invention;
The structural representation of the lightweight XML analytical framework that the streaming that Fig. 2 provides for the embodiment of the present invention resolves
Figure;
The node configuration information that Fig. 3 provides for the embodiment of the present invention loads flow chart;
The feature extraction flow chart that Fig. 4 provides for the embodiment of the present invention;
The data parsing flow chart that Fig. 5 provides for the embodiment of the present invention;
The structural representation of the resolver of the XML data that Fig. 6 provides for the embodiment of the present invention.
Detailed description of the invention
In order to solve problems of the prior art, embodiments provide a kind of XML data
Parsing scheme.In this technical scheme, it is determined by the document object type of XML data to be resolved, root
According to the corresponding relation of the document object type prestored Yu node configuration information, the document pair obtaining Yu determining
As the node configuration information that type is corresponding, further according to the node diagnostic number comprised in the node configuration information obtained
According to the data type with node, and the business object of other node beyond the node that digs up the roots is assigned to his father
The mode of the business object of node, it is achieved the parsing to XML data to be resolved, compared with prior art,
XML data can be converted directly into business object, it is to avoid need when traditional X-ray ML resolves to build literary composition
Shelves model object is as intermediate object program thus easily causes the risk that internal memory overflows, and solves at parsing super large
Performance bottleneck during XML data, reduces the expense of Installed System Memory and CPU, makes analysis feature substantially carry
Rise.
Below in conjunction with Figure of description, embodiments of the invention are illustrated, it will be appreciated that described herein
Embodiment be merely to illustrate and explain the present invention, be not limited to the present invention.And in the feelings do not conflicted
Under condition, embodiment and the feature of embodiment in the present invention can be combined with each other.
Embodiments provide the analytic method of a kind of XML data, as it is shown in figure 1, be the method
Flowchart, specifically include following step:
Step 11, determines the document object type of XML data to be resolved.
In general, XML data to be resolved can specify the document object type of self, if this waits to solve
The XML data of analysis does not specify the document object type of self, then can be according to the lattice of XML data
Formula determines the root node in XML data, and the nodename of root node is defined as the literary composition of XML data
Shelves object type.Wherein, during the root node of XML data is XML data first comprise beginning label and
The node of end mark.
Step 12, from the node configuration information prestored, obtains the document object class with XML data
The node configuration information that type is corresponding;Wherein, node configuration information comprises: node diagnostic data and node
Data type.
In the embodiment of the present invention, the node diagnostic data comprised in node configuration information are for identifying XML number
Node according to, it can be, but not limited to include: nodename, the beginning label of node, the end of node
Labelling, the father node of node and node describe information etc..
The data type of the node comprised in node configuration information, for determining the concrete analysis mode of node, is wrapped
Include initial form and object type, wherein the node in XML data when resolving collectively as initial form
Process, only when the father node that present node is other one or more nodes, just using this node as right
As type of process.
Wherein, node configuration information can be stored in advance in repository.When performing step 12, permissible
From the node configuration information being stored in advance in repository, obtain the document object type with XML data
Corresponding node configuration information.But the reading efficiency that this mode can cause node configuration information is too low.
Therefore, in the embodiment of the present invention, in order to the reading efficiency obtaining node configuration information can be improved, can
Automatically to load the node configuration information in repository (before step 11) when system start-up, and press
Document object type according to its correspondence stores to caching so that when the document object determining XML data
After type, can be directly according to document object type, from the node configuration information prestored in the buffer
In, obtain corresponding node configuration information, thus improve the reading efficiency of node configuration information.
Step 13, performs operations described below successively to each row of data in this XML data, until having resolved this
XML data:
According to the node diagnostic data comprised in the node configuration information obtained and the data type of node, determine
Node corresponding to Current Datarow and the data type of this node;
According to the data type of this node, this node is resolved, obtain the business object of this node;
Concrete, when the data type of this node is initial form, obtain the primitive class offset of this node,
As the business object for this node;
When the data type of this node is object type, create new business object for this node, as this
The business object of node.
When this node is not the root node in XML data, the business object obtained is assigned to this node
The business object of father node.
In the embodiment of the present invention, it is determined by the document object type of XML data to be resolved, according in advance
The document object type first stored and the corresponding relation of node configuration information, the document object class obtaining Yu determining
The node configuration information that type is corresponding, further according to the node diagnostic data that comprise in the node configuration information obtained and
The data type of node, and the business object of other node beyond the node that digs up the roots is assigned to its father node
The mode of business object, it is achieved the parsing to XML data to be resolved, compared with prior art, energy
Enough XML data is converted directly into business object, it is to avoid need to build document when traditional X-ray ML resolves
Model object is as intermediate object program thus easily causes the risk that internal memory overflows, and solves at parsing super large
Performance bottleneck during XML data, reduces the expense of Installed System Memory and CPU, makes analysis feature substantially carry
Rise.
The XML analytic method that the embodiment of the present invention provides can be, but not limited to apply in transaction system.
In order to be better understood from the embodiment of the present invention, implement the tool to the embodiment of the present invention below in conjunction with concrete
Body implementation process illustrates.
In transaction system, the information exchange that the main purpose of XML data is by between system.Transaction system
XML data in system also has one to compare salient feature, it is simply that node type is substantially element, base
Originally there is no attribute type.XML data is especially suitable for packaging with the feature of himself needs the data of exchange,
In transaction system, user is substantially without being concerned about its structurized document model object simultaneously, and user is paid close attention to
It is the data of its carrying.Therefore, the XML data being used as inter-system data transmission in transaction system is general
Having a characteristic that and be methodically arranged, structure is clearly demarcated, and system generates, automatic assignment.
According to the feature of above-mentioned XML data, the embodiment of the present invention devises the lightweight that a streaming resolves
XML analytical framework, its structure is illustrated in fig. 2 shown below.Wherein:
1, repository
It is mainly used in preserving node configuration information.
Wherein, a corresponding node configuration information of node, a typical node configuration information can wrap
Include as properties:
1) document object type, belongs to an XML data to be resolved for one group of attribute of mark;
2) tie of the business object binding of nodename, XML data interior joint and Java, by reflection
The business object that nodename be assigned to Java machine-processed with dynamic proxy;
3) node describes information;
4) node type, element or attribute;
5) node sequence, node order in XML data;
6) father node, the even higher level of node of present node, usually object type;Father node is that sky is then
Root node.
7) beginning label, the characteristic character that mark node starts;
8) end mark, the characteristic character that mark node terminates;
9) data type, the Java data type that node is corresponding, point initial form and object type two kinds;
Character string is treated because its particularity also serves as initial form when processing;
10) the most plural, if node repeatedly occurs under same father node, it is believed that it is plural form,
Father node can preserve with array;
11) whether it is root node.
2, Configuration Manager
Automatically the node configuration information in repository is loaded when system start-up, and according to document object type handle
Repository arranges as the most independent unit and is put in caching management.Need to use node when resolving to join
During confidence breath, directly according to the node configuration information reading correspondence in document object type to caching, it is to avoid every
Secondary all go read repository, thus improve load node configuration information efficiency.
3, characteristic extracting module
When the XML data received does not specifies document object type, automatic according to XML format feature
Extract the nodename of root node, and automatically load the node configuration letter of correspondence according to the nodename of root node
Breath.
4, data resolution module
This module is the key component of whole analytical framework, in it resolves in XML data with streaming order
Hold.First business object is generated according to root node, then other node being resolved to according to its data type,
Their business object is assigned to the business object of their father node in the way of reflection with dynamic proxy.
5, object generation module
The all business objects being resolved to are returned to caller with the form of array.
On the basis of above-mentioned analytical framework, separately below node configuration information is loaded flow process, feature extraction
Flow process and XML data process of analysis are introduced.
As it is shown on figure 3, load flow chart for node configuration information.Idiographic flow includes:
Step 31, when system start-up, first obtains configuration path;
Step 32, the configuration path according to obtaining reads all of node configuration information from repository;
Step 33, arranges, by node configuration information according to literary composition all of node configuration information read
Shelves object type is organized into separate unit one by one;
Step 34, stores each separate unit in the buffer for key assignments with document object type.
As shown in Figure 4, extraction flow chart it is characterized.Idiographic flow includes:
Step 41, it is judged that whether XML data carries document object type;If this XML data is carried
Document object type, then perform step 45;If this XML data does not carries document object type, then hold
Row step 42.
Step 42, determines first node comprising beginning label and end mark in XML data.
Concrete, determine that process can use exclusive method, first remove empty string, get rid of in XML data
Header, Schema information etc..When finding the node that first comprises beginning label and end mark, i.e. recognize
It is root node for it.
Step 43, determines the nodename of this node.
Step 44, is defined as the document object type of XML data by the nodename of this node.
Step 45, the document object type carried is defined as the document object type of this XML data.
As it is shown in figure 5, be data parsing flow chart.Idiographic flow includes:
Step 51, determines the document object type of XML data to be resolved;
Step 52, from prestoring node configuration information in the buffer, the document object obtaining Yu determining
The node configuration information that type is corresponding;
Step 53, reads XML data row;
Step 54, mates the node configuration information of acquisition with the XML data row of reading, until really
The node configuration information that the XML data row made and read mates, determines the XML data row pair of reading
The node answered and the data type of this node;When the data type of node is initial form, perform step 55,
When the data type of node is object type, perform step 56.
Step 55, obtains the primitive class offset of this node, as the business object for this node;
Step 56, creates new business object for this node, as the business object of this node;
Concrete, can be that this node creates new business object, as this according to the nodename of this node
The business object of node.
Step 57, it is judged that whether this node is the root node of XML data;If this node is XML number
According to root node, then perform step 58, if this node is not the root node of XML data, then perform step
Rapid 59.
Step 58, adds to the business object of this node in array;
Step 59, is assigned to the business object of the father node of this node by the business object of this node;
Step 510, it may be judged whether resolved this XML data, without having resolved this XML data,
Then returning and continue executing with step 53, if having resolved this XML data, then performing step 511.
Step 511, returns analysis result.
In the embodiment of the present invention, it is determined by the document object type of XML data to be resolved, according in advance
The document object type first stored and the corresponding relation of node configuration information, the document object class obtaining Yu determining
The node configuration information that type is corresponding, further according to the node diagnostic data that comprise in the node configuration information obtained and
The data type of node, and the business object of other node beyond the node that digs up the roots is assigned to its father node
The mode of business object, it is achieved the parsing to XML data to be resolved, compared with prior art, energy
Enough XML data is converted directly into business object, it is to avoid need to build document when traditional X-ray ML resolves
Model object is as intermediate object program thus easily causes the risk that internal memory overflows, and solves at parsing super large
Performance bottleneck during XML data, reduces the expense of Installed System Memory and CPU, makes analysis feature substantially carry
Rise.
Based on same inventive concept, the embodiment of the present invention additionally provides the resolver of a kind of XML data,
Due to said apparatus, to solve the principle of problem to the analytic method of XML data similar, therefore said apparatus
Implement the enforcement of the method that may refer to, repeat no more in place of repetition.
As shown in Figure 6, for the structural representation of resolver of the XML data that the embodiment of the present invention provides,
Including:
Document object type determining units 61, for determining the document object type of XML data to be resolved;
Node configuration information acquiring unit 62, for from the node configuration information prestored, obtains and institute
State the node configuration information that document object type that document object type determining units 61 determines is corresponding;Wherein,
Described node configuration information comprises: node diagnostic data and the data type of node;
Resolution unit 63, for performing operations described below successively to each row of data in described XML data, directly
To having resolved described XML data:
Special according to the node comprised in the node configuration information that described node configuration information acquiring unit 62 obtains
Levy the data type of data and node, determine node and the data class of described node that Current Datarow is corresponding
Type;According to the data type of described node, described node is resolved, obtain the business pair of described node
As;When root node during described node is not described XML data, the business object obtained is assigned to
The business object of the father node of described node.
Wherein, described resolution unit 63, specifically for:
When the data type of described node is initial form, obtain the primitive class offset of described node, as
Business object for described node;
When the data type of described node is object type, create new business object for described node, make
Business object for described node.
Wherein, described document object type determining units 61, specifically include:
Judge module 611, is used for judging whether to carry in described XML data document object type;
First judged result module 612, for judging described XML data when described judging unit 611
In when carrying document object type, the document object type described XML data carried is defined as described
The document object type of XML data;
Second judged result module 613, for judging described XML data when described judge module 611
In when not carrying document object type, the nodename of the root node of described XML data is defined as described
The document object type of XML data.
Wherein, described second judged result module 613, specifically for:
Determine the root node in described XML data;Wherein said root node is in described XML data
One node comprising beginning label and end mark;Nodename by the root node of described XML data
It is defined as the document object type of described XML data.
Wherein, described device also includes:
Read unit 64, for reading the node configuration information prestored from repository;
Buffer unit 65, the node configuration information being used for reading described reading unit 64 is according to its correspondence
Document object type stores in the buffer;Then
Described node configuration information acquiring unit 62, specifically for:
Prestore node configuration information in the buffer from described buffer unit 65, obtain and described literary composition
The node configuration information that shelves object type is corresponding.
For convenience of description, above each several part is divided by function and is respectively described for each module (or unit).
Certainly, when implementing the present invention can the function of each module (or unit) at same or multiple softwares or
Hardware realizes.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or meter
Calculation machine program product.Therefore, the present invention can use complete hardware embodiment, complete software implementation or knot
The form of the embodiment in terms of conjunction software and hardware.And, the present invention can use and wherein wrap one or more
Computer-usable storage medium containing computer usable program code (include but not limited to disk memory,
CD-ROM, optical memory etc.) form of the upper computer program implemented.
The present invention is with reference to method, equipment (system) and computer program product according to embodiments of the present invention
The flow chart of product and/or block diagram describe.It should be understood that can by computer program instructions flowchart and
/ or block diagram in each flow process and/or flow process in square frame and flow chart and/or block diagram and/
Or the combination of square frame.These computer program instructions can be provided to general purpose computer, special-purpose computer, embedding
The processor of formula datatron or other programmable data processing device is to produce a machine so that by calculating
The instruction that the processor of machine or other programmable data processing device performs produces for realizing at flow chart one
The device of the function specified in individual flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and computer or the process of other programmable datas can be guided to set
In the standby computer-readable memory worked in a specific way so that be stored in this computer-readable memory
Instruction produce and include the manufacture of command device, this command device realizes in one flow process or multiple of flow chart
The function specified in flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, makes
Sequence of operations step must be performed to produce computer implemented place on computer or other programmable devices
Reason, thus the instruction performed on computer or other programmable devices provides for realizing flow chart one
The step of the function specified in flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know base
This creativeness concept, then can make other change and amendment to these embodiments.So, appended right is wanted
Ask and be intended to be construed to include preferred embodiment and fall into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification without deviating from this to the present invention
Bright spirit and scope.So, if the present invention these amendment and modification belong to the claims in the present invention and
Within the scope of its equivalent technologies, then the present invention is also intended to comprise these change and modification.
Claims (10)
1. the analytic method of expandable mark language XML data, it is characterised in that including:
Determine the document object type of XML data to be resolved;
From the node configuration information prestored, obtain the node configuration corresponding with described document object type
Information;Wherein, described node configuration information comprises: node diagnostic data and the data type of node;
Each row of data in described XML data is performed operations described below successively, until having resolved described XML
Data:
According to the node diagnostic data comprised in described node configuration information and the data type of node, determine and work as
Node that the data that move ahead are corresponding and the data type of described node;
According to the data type of described node, described node is resolved, obtain the business pair of described node
As;
When root node during described node is not described XML data, the business object obtained is assigned to
The business object of the father node of described node.
2. the method for claim 1, it is characterised in that according to the data type of described node,
Described node is resolved, obtains the business object of described node;
When the data type of described node is initial form, obtain the primitive class offset of described node, as
Business object for described node;
When the data type of described node is object type, create new business object for described node, make
Business object for described node.
3. the method for claim 1, it is characterised in that determine the literary composition of XML data to be resolved
Shelves object type, specifically includes:
Judge whether described XML data carries document object type;
When judging described XML data carries document object type, described XML data is taken
The document object type of band is defined as the document object type of described XML data;
When judging described XML data does not carries document object type, by described XML data
The nodename of root node is defined as the document object type of described XML data.
4. method as claimed in claim 3, it is characterised in that by the root node of described XML data
Nodename is defined as the document object type of described XML data, specifically includes:
Determine the root node in described XML data;Wherein said root node is in described XML data
One node comprising beginning label and end mark;
The nodename of the root node of described XML data is defined as the document object of described XML data
Type.
5. the method for claim 1, it is characterised in that determine the literary composition of XML data to be resolved
Before shelves object type, described method also includes:
The node configuration information prestored is read from repository;
The node configuration information read is stored in the buffer according to the document object type of its correspondence;Then
From the node configuration information prestored, obtain the node configuration corresponding with described document object type
Information, specifically includes:
From prestoring node configuration information in the buffer, obtain corresponding with described document object type
Node configuration information.
6. the resolver of expandable mark language XML data, it is characterised in that including:
Document object type determining units, for determining the document object type of XML data to be resolved;
Node configuration information acquiring unit, for from the node configuration information prestored, obtains with described
The node configuration information that document object type that document object type determining units determines is corresponding;Wherein, described
Node configuration information comprises: node diagnostic data and the data type of node;
Resolution unit, for each row of data in described XML data is performed operations described below successively, until
Resolve described XML data:
According to the node diagnostic comprised in the node configuration information that described node configuration information acquiring unit obtains
Data and the data type of node, determine node and the data type of described node that Current Datarow is corresponding;
According to the data type of described node, described node is resolved, obtain the business object of described node;
When root node during described node is not described XML data, the business object obtained is assigned to described
The business object of the father node of node.
7. device as claimed in claim 6, it is characterised in that described resolution unit, specifically for:
When the data type of described node is initial form, obtain the primitive class offset of described node, as
Business object for described node;
When the data type of described node is object type, create new business object for described node, make
Business object for described node.
8. device as claimed in claim 6, it is characterised in that described document object type determining units,
Specifically include:
Judge module, is used for judging whether to carry in described XML data document object type;
First judged result module, for carrying in described judging unit judges described XML data
During document object type, the document object type described XML data carried is defined as described XML number
According to document object type;
Second judged result module, for not carrying in described judge module judges described XML data
During document object type, the nodename of the root node of described XML data is defined as described XML number
According to document object type.
9. device as claimed in claim 8, it is characterised in that described second judged result module, tool
Body is used for:
Determine the root node in described XML data;Wherein said root node is in described XML data
One node comprising beginning label and end mark;Nodename by the root node of described XML data
It is defined as the document object type of described XML data.
10. device as claimed in claim 6, it is characterised in that described device also includes:
Read unit, for reading the node configuration information prestored from repository;
Buffer unit, for the node configuration information that read by described reading unit according to the document pair of its correspondence
As type stores in the buffer;Then
Described node configuration information acquiring unit, specifically for:
From the node configuration information that described buffer unit prestores in the buffer, obtain and described document pair
As the node configuration information that type is corresponding.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510357844.6A CN106293862B (en) | 2015-06-25 | 2015-06-25 | A kind of analysis method and device of expandable mark language XML data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510357844.6A CN106293862B (en) | 2015-06-25 | 2015-06-25 | A kind of analysis method and device of expandable mark language XML data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106293862A true CN106293862A (en) | 2017-01-04 |
CN106293862B CN106293862B (en) | 2019-05-24 |
Family
ID=57650805
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510357844.6A Active CN106293862B (en) | 2015-06-25 | 2015-06-25 | A kind of analysis method and device of expandable mark language XML data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106293862B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109144500A (en) * | 2018-07-30 | 2019-01-04 | 深圳点猫科技有限公司 | A kind of skin file processing method and electronic equipment based on graphic programming |
CN109818926A (en) * | 2018-12-25 | 2019-05-28 | 西安长远电子工程有限责任公司 | A kind of communication means without planning in advance |
CN109918540A (en) * | 2019-02-26 | 2019-06-21 | 深圳市元征科技股份有限公司 | A kind of XML document analytic method, system and electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030181196A1 (en) * | 2002-03-22 | 2003-09-25 | Eran Davidov | Extensible framework for code generation from XML tags |
CN101777045A (en) * | 2008-09-01 | 2010-07-14 | 西北工业大学 | Method for analyzing XML file by indexing |
CN102622444A (en) * | 2012-03-15 | 2012-08-01 | 深圳市同洲视讯传媒有限公司 | XML (extensible markup language) message processing method and XML message processing device |
-
2015
- 2015-06-25 CN CN201510357844.6A patent/CN106293862B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030181196A1 (en) * | 2002-03-22 | 2003-09-25 | Eran Davidov | Extensible framework for code generation from XML tags |
CN101777045A (en) * | 2008-09-01 | 2010-07-14 | 西北工业大学 | Method for analyzing XML file by indexing |
CN102622444A (en) * | 2012-03-15 | 2012-08-01 | 深圳市同洲视讯传媒有限公司 | XML (extensible markup language) message processing method and XML message processing device |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109144500A (en) * | 2018-07-30 | 2019-01-04 | 深圳点猫科技有限公司 | A kind of skin file processing method and electronic equipment based on graphic programming |
CN109144500B (en) * | 2018-07-30 | 2021-01-05 | 深圳点猫科技有限公司 | Skin file processing method based on graphical programming and electronic equipment |
CN109818926A (en) * | 2018-12-25 | 2019-05-28 | 西安长远电子工程有限责任公司 | A kind of communication means without planning in advance |
CN109918540A (en) * | 2019-02-26 | 2019-06-21 | 深圳市元征科技股份有限公司 | A kind of XML document analytic method, system and electronic equipment and storage medium |
CN109918540B (en) * | 2019-02-26 | 2023-04-21 | 深圳市元征科技股份有限公司 | XML document analysis method and system, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106293862B (en) | 2019-05-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106022483B (en) | The method and apparatus converted between machine learning model | |
CN104156313B (en) | Method for automatically generating Web service testing case | |
US8121976B2 (en) | Method and apparatus for converting legacy programming language data structures to schema definitions | |
US8762426B2 (en) | Method and system of adapting a data model to a user interface component | |
CN108399130A (en) | Method, device and equipment for automatically generating test case and readable storage medium | |
CN106611044B (en) | SQL optimization method and equipment | |
CN108337236A (en) | A kind of gRPC call methods and device based on Protobuf and HTTP/1.1 | |
CN102566984B (en) | Method and device for configuring parameters | |
CN107368503A (en) | Method of data synchronization and system based on Kettle | |
CN110333863A (en) | A kind of method and device for generating, showing the small routine page | |
US20100082523A1 (en) | Configuration rule translation mapper | |
CN108509199A (en) | Method, device, equipment and storage medium for automatically generating Chinese annotations | |
CN105068802B (en) | A kind of Web application software realization system and method for striding equipment operation | |
CN109116828A (en) | Model code configuration method and device in a kind of controller | |
CN113821565B (en) | Method for synchronizing data by multiple data sources | |
CN110162299A (en) | Web program and its Quick Development Framework, development approach and relevant device | |
US8615729B2 (en) | Extending existing model-to-model transformations | |
CN108664546B (en) | XML data structure conversion method and device | |
CN109063091B (en) | Data migration method and device for hybrid coding and storage medium | |
CN105468793A (en) | Automated management method for simulation model data | |
CN110941655A (en) | Data format conversion method and device | |
CN106293862A (en) | A kind of analysis method and device of expandable mark language XML data | |
CN104750468B (en) | A kind of server-side topological data conversion method and conversion equipment | |
CN106776779B (en) | Method for generating entity file by JSON data based on Mac platform | |
CN112860584B (en) | Workflow model-based testing method and device |
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 |