CN106951399B - Method and device for quickly generating ONIX standard file - Google Patents

Method and device for quickly generating ONIX standard file Download PDF

Info

Publication number
CN106951399B
CN106951399B CN201710178592.XA CN201710178592A CN106951399B CN 106951399 B CN106951399 B CN 106951399B CN 201710178592 A CN201710178592 A CN 201710178592A CN 106951399 B CN106951399 B CN 106951399B
Authority
CN
China
Prior art keywords
file
onix
path
template
target product
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710178592.XA
Other languages
Chinese (zh)
Other versions
CN106951399A (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.)
BEIJING JETSEN TECHNOLOGY CO LTD
Original Assignee
BEIJING JETSEN TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING JETSEN TECHNOLOGY CO LTD filed Critical BEIJING JETSEN TECHNOLOGY CO LTD
Priority to CN201710178592.XA priority Critical patent/CN106951399B/en
Publication of CN106951399A publication Critical patent/CN106951399A/en
Application granted granted Critical
Publication of CN106951399B publication Critical patent/CN106951399B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents

Abstract

The invention provides a method and a device for quickly generating an ONIX standard file, wherein the method comprises the steps of positioning each level element in an ONIX specification by adopting a preset path language, converting target product information into an intermediate file at least part of which content accords with the ONIX specification according to the path file obtained by positioning, normalizing the intermediate file to ensure that all the content accords with the ONIX specification, and finally quickly generating the ONIX standard file corresponding to the target product information through template synthesis. Therefore, the invention realizes an automatic scheme for quickly generating the ONIX standard file, a user only needs to provide the information of the target product to be converted and triggers the generation process of the ONIX standard file to realize the quick generation of the ONIX standard file without considering the file structure of the ONIX standard, and the problems of complicated process, relatively low efficiency and the like when the ONIX standard file is generated in the prior art are effectively solved.

Description

Method and device for quickly generating ONIX standard file
Technical Field
The invention belongs to the technical field of digital publishing, and particularly relates to a method and a device for quickly generating an ONIX (online information exchange) standard file.
Background
Under the background of the mobile internet and big data era, the convergence trend of traditional publishing and emerging media is increasingly unblocked, ONIX can uniformly specify the description and exchange format of book product information in the field of publication logistics, can meet the requirement that a publisher transmits the electronic information of the book to the terminal clients such as issuers (such as wholesalers, distributors, retailers, online bookstores or other publishing houses) and libraries and other related trading partners on the supply chain related to book sales through the Internet, the ONIX specification provides a digital solution for comprehensively and deeply developing, utilizing and managing the product information of the publication, the method can realize 'one-time processing and whole-process sharing' of the product information of the publication by integrating the publication issuing information resources, and provides a required technical basis for constructing a cross-language, cross-media and cross-region open publication logistics communication platform.
With the development of ONIX and the advent of the national standard CNONIX (CN Online Information eXchange, China Online Information eXchange), ONIX files and related derivative standards thereof as publication Information carriers will be widely applied in the publishing industry. At present, when the ONIX file and related derivative standards thereof are used as a publication information carrier, the ONIX standard file corresponding to the publication product information is usually generated by the following method:
(1) defining and manually creating a node object corresponding to each element in the ONIX specification one by one;
(2) constructing a parent-child relationship among the node objects according to the hierarchical relationship among the elements in the ONIX specification, and creating an example of each node object based on the publication product information;
(3) and serializing root nodes of the ONIX file (the created file where the node object is located) to generate a corresponding ONIX standard file.
The above method for generating the ONIX standard file obviously has the following disadvantages: a creator needs to spend a great deal of time manually creating node objects and constructing parent-child relationships among the node objects; and because the ONIX specification/standard is complex and has more hierarchical structures, the creation process is complicated when a creator manually creates an ONIX standard file depending on the document structure/hierarchical structure of the ONIX specification.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for quickly generating an ONIX standard file, and aims to solve the technical problems of a complex creation process and relatively low efficiency in generating an ONIX standard file in the prior art.
Therefore, the invention discloses the following technical scheme:
a method for rapidly generating an ONIX standard file comprises the following steps:
obtaining target product information to be converted;
acquiring an ONIX template file in a preset file format created according to the ONIX specification and a path file in a preset path language format created according to the ONIX specification; wherein the ONIX template file comprises: the path file comprises a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, wherein the path file comprises path information of each element established according to a hierarchical relation of each element provided in the ONIX specification;
converting the target product information into an intermediate file at least part of content of which conforms to ONIX specification according to the path file; wherein the intermediate file comprises: each element node which accords with the path information in the path file and is instantiated based on the target product information;
when only part of contents of the intermediate file conform to ONIX specifications, carrying out standardization processing on the intermediate file to obtain a processing result file with all contents conforming to ONIX specifications;
and performing preset synthesis processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information.
The method, preferably, the obtaining target product information to be converted includes:
and collecting target product information and generating a form file containing the target product information.
Preferably, the method for creating an ONIX template file in a predetermined file format and a path file in a predetermined path language format according to the ONIX specification includes:
according to ONIX specification, an ONIX template file is created by adopting an extensible markup language XML file format;
and establishing path information of each element by adopting XML path language Xpath according to the hierarchical relation of each element provided by the ONIX specification to obtain a path file.
In the above method, preferably, only part of the content of the intermediate file conforms to the ONIX specification: determining that at least one local resource address which does not conform to ONIX specification exists in the intermediate file through resource check;
then, when only part of the content of the intermediate file conforms to the ONIX specification, performing normalization processing on the intermediate file includes:
uploading at least one local resource corresponding to at least one local resource address in the intermediate file to a network space, and obtaining a Uniform Resource Identifier (URI) corresponding to the uploaded resource in the network space;
and replacing at least one local resource address in the intermediate file with a corresponding Uniform Resource Identifier (URI).
In the method, preferably, the performing of the predetermined synthesis process on the processing result file and the ONIX template file includes:
creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file;
and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
Preferably, the method further includes, after obtaining the ONIX template file in the predetermined file format created according to the ONIX specification:
and verifying the correctness of the ONIX template file according to a preset verification specification by using a corresponding verification tool.
An apparatus for rapidly generating an ONIX standard file, comprising:
the first acquisition unit is used for acquiring target product information to be converted;
a second obtaining unit, configured to obtain an ONIX template file in a predetermined file format created according to the ONIX specification, and a path file in a predetermined path language format created according to the ONIX specification; wherein the ONIX template file comprises: the path file comprises a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, wherein the path file comprises path information of each element established according to a hierarchical relation of each element provided in the ONIX specification;
the conversion unit is used for converting the target product information into an intermediate file at least part of content of which conforms to ONIX specification according to the path file; wherein the intermediate file comprises: each element node which accords with the path information in the path file and is instantiated based on the target product information;
the processing unit is used for carrying out standardization processing on the intermediate file when only part of contents of the intermediate file conform to ONIX specifications to obtain a processing result file with all contents conforming to ONIX specifications;
and the synthesis unit is used for carrying out preset synthesis processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information.
The above apparatus, preferably, the first obtaining unit is further configured to:
and collecting target product information and generating a form file containing the target product information.
In the apparatus, preferably, the creating process of the ONIX template file and the path file acquired by the second acquiring unit includes:
according to ONIX specification, an ONIX template file is created by adopting an extensible markup language XML file format; and establishing path information of each element by adopting XML path language Xpath according to the hierarchical relation of each element provided by the ONIX specification to obtain a path file.
In the above apparatus, preferably, only part of the content of the intermediate file conforms to the ONIX specification as follows: determining that at least one local resource address which does not conform to ONIX specification exists in the intermediate file through resource check; the processing unit is further configured to:
uploading at least one local resource corresponding to at least one local resource address in the intermediate file to a network space, and obtaining a Uniform Resource Identifier (URI) corresponding to the uploaded resource in the network space; and replacing at least one local resource address in the intermediate file with a corresponding Uniform Resource Identifier (URI).
The above apparatus, preferably, the synthesis unit is further configured to:
creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file; and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
The above apparatus, preferably, further comprises:
and the verification unit is used for verifying the correctness of the ONIX template file according to a preset verification specification by using a corresponding verification tool.
According to the scheme, the method for rapidly generating the ONIX standard file comprises the steps of positioning each layer of element in the ONIX specification by adopting a preset path language (such as XPath), converting target product information into an intermediate file with at least part of content meeting the ONIX specification according to the path file containing the path information of each layer of element obtained by positioning, normalizing the intermediate file to enable all the content to meet the ONIX specification, and finally rapidly generating the ONIX standard file corresponding to the target product information through template synthesis. Therefore, the automatic implementation scheme for rapidly generating the ONIX standard file is realized, when the scheme is utilized, a user only needs to provide the information of the target product to be converted and triggers the generation process of the ONIX standard file to rapidly generate the ONIX standard file, the document structure/hierarchical structure of the ONIX specification does not need to be considered, and the technical problems that the process is complex, the efficiency is relatively low and the like when the ONIX standard file is generated in the prior art are effectively solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for rapidly generating an ONIX standard file according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an acquisition interface of target product information according to an embodiment of the present invention;
FIG. 3 is a flow chart of additional resource processing provided by an embodiment of the invention;
FIG. 4 is a schematic flow chart illustrating a method of the present invention according to an embodiment of the present invention;
fig. 5 is a flowchart of a method for quickly generating an ONIX standard file according to a second embodiment of the present invention;
fig. 6 to fig. 7 are schematic structural diagrams of an apparatus for rapidly generating an ONIX standard file according to a third embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
An embodiment of the present invention provides a method for quickly generating an ONIX standard file, which is used for generating an ONIX standard file corresponding to product information of various publications such as books, electronic books, optical discs, and the like, and refers to a flowchart of a method for quickly generating an ONIX standard file shown in fig. 1, where the method may include the following steps:
and step 101, obtaining target product information to be converted.
The target product information to be converted may be product information corresponding to various publications such as books, electronic books, optical discs and the like having the need of generating the ONIX standard file, and the publication product information generally includes but is not limited to a plurality of information such as book names, prices, publishing houses, publishing places, product forms and the like.
Specifically, the invention acquires and obtains target product information to be converted, namely target product information with ONIX standard file generation requirements, input by a user through a graphical interactive interface provided for the user, and referring to FIG. 2, FIG. 2 shows an interface example diagram of the graphical interactive interface with a product information acquisition function.
When a user has a need for generating ONIX standard files of a certain product or a certain batch of products, corresponding product information can be input through the graphical interactive interface, on the basis, an executive body of the method, such as a processing device or a system which is realized in a software mode and has processing logic of the method, collects the product information input by the user on the graphical interactive interface, and generates a corresponding form file based on the collected product information so as to provide a required product information basis for the generation of a subsequent ONIX standard file.
In other embodiments of the present invention, the target product information to be converted may also be obtained by automatic extraction, for example, for a certain electronic book with the ONIX standard file generation requirement, the acquisition of the target product information may be realized by automatically extracting (rather than manually inputting) information of the book name, price, publisher, and the like of the electronic book.
102, obtaining an ONIX template file with a preset file format created according to an ONIX specification and a path file with a preset path language format created according to the ONIX specification; wherein the ONIX template file comprises: a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, the path file including path information of the respective elements established according to a hierarchical relationship of the respective elements provided in the ONIX specification.
The method of the invention creates a universal ONIX template file and a path file according to the ONIX specification, and then combines and utilizes the ONIX template file, the path file and the target product information to be converted to generate an ONIX standard file corresponding to the target product information.
The ONIX specification provides the hierarchical relationships between the various elements, attributes, and elements that make up the ONIX standard file. Specifically, in general, the ONIX specification provides a root element onixMessage (root element is used to declare an ONIX message), a product element product, and various other elements such as a title, a price, and a publisher, and also specifies attributes of the corresponding elements, such as a title, a name of a side book, and the like, and a hierarchical relationship between the elements, for example, the product element product is a lower-layer element of the root element onixMessage, and the like is a lower-layer element of the product element such as a title, a price, and a publisher, and the like.
In this embodiment, an eXtensible Markup Language (XML) file format is specifically used to create an ONIX template file, where the created ONIX template file reserves a root element and a namespace of an ONIX specification, that is, an XML is used to describe an onixMessage element and a product element in the ONIX specification, so that the created ONIX template file includes an onixMessage root node and a product child node described based on the XML.
Accordingly, in this embodiment, according to the hierarchical relationship of each element provided by the ONIX specification, path information of each element is established by using Xpath (XML path language), so as to obtain a path file. The method includes the steps that a unique XPath path needs to be created for each child node (corresponding to other elements except a root element), namely, each node is guaranteed to have a unique corresponding position, so that keywords such as 'or' are not allowed to appear in the condition description of the node in the XPath path, but keywords such as 'and' are allowed to appear, if a parent node corresponding to the child node has a fixed value (such as a declarative numerical value of the parent node), description of a parent node value also needs to be added in the XPath description, for the parent node corresponding to the child node, an independent XPath path does not need to be separately described for the parent node, and when the child node is created, a system automatically creates a corresponding parent node for the child node according to the path of the child node.
After the path file is created, the created path file needs to be saved, the saving format allows customization, and the path file can be directly described through enumeration variables or saved in an XML format. In this embodiment, the path file is specifically saved by using a scheme described by enumerating variables.
It should be noted that the ONIX template file and the path file are general files required for generating an ONIX standard file, and the ONIX template file and the path file do not change correspondingly even when the content of the ONIX specification does not change (such as upgrade update, etc.), and based on this, the generation process of the ONIX template file and the path file can be completed in advance as a preprocessing step of the method of the present invention, so that the preinstalled ONIX template file and the path file can be directly obtained and used when the ONIX standard file is generated.
Step 103, converting the target product information into an intermediate file with at least part of content meeting ONIX specifications according to the path file; wherein the intermediate file comprises: and each element node which accords with the path information in the path file and completes the instantiation based on the target product information.
On the basis of obtaining target product information to be converted, a universal ONIX standard file and a path file, the step converts the target product information into an intermediate file of which at least part of content meets ONIX specifications according to the path file.
Wherein the generation process of the intermediate file with at least part of content conforming to ONIX specification comprises the following steps:
1) identifying each level node in an Xpath contained in the path file, and the attribute (including node type, ID and the like) and attribute value of the node;
2) and sequentially creating the nodes and the attributes according to the identified nodes and attribute values.
Specifically, a node is created based on the recognition result, attributes corresponding to the node are created, and finally, corresponding information in the target product information is used for assigning values to the node, so that the node is instantiated. If a node with the same path is encountered in the process of creating the node, an additional strategy is adopted, namely a new sibling node is added under an existing node, for example, the target product information may contain two covers which can be replaced mutually, and the purpose is to enable the user to use different covers for publication at different publishers/publication dates.
3) And (3) repeatedly executing the step 2) by adopting a recursion strategy, and after the recursion process is completed, generating and instantiating nodes corresponding to all XPath in the whole path file, so that an intermediate file with at least part of content meeting ONIX specifications can be obtained.
Wherein the ONIX specification requires that the numeric reference content of all additional resources in the ONIX file be a Uniform Resource Identifier (URI) without allowing the presence of local Resource addresses such as local Resource links. Based on this, at least part of the content of the intermediate file conforms to the ONIX specification, meaning that there may be local resource addresses in the intermediate file that are not allowed by the ONIX specification, i.e. do not conform to the ONIX specification. In view of the fact that the intermediate file may or may not include the local resource address, the generated intermediate file may or may not completely comply with the ONIX specification (the case where the local resource address is not included), that is, at least part of the content of the intermediate file conforms to the ONIX specification.
And 104, when only part of contents of the intermediate file conform to ONIX specifications, carrying out standardization processing on the intermediate file to obtain a processing result file with all contents conforming to ONIX specifications.
Considering that the intermediate file may contain a local resource address not allowed by the ONIX specification, referring to fig. 3, this step specifically determines whether the intermediate file contains a local resource address by performing resource check on the intermediate file and analyzing addresses of all additional resources in the intermediate file, and if a node of the intermediate file contains a local resource address, places the node into a pre-created XML node container.
For each node which does not accord with the ONIX specification in the XML node container, reading a local resource address which does not accord with the ONIX specification and is contained in the XML node container, further obtaining a local resource indicated by the local resource address, uploading the local resource to a network space, converting the local resource into the network resource, and simultaneously obtaining a uniform resource identifier URI (URI) corresponding to the uploaded resource in the network space, wherein the network space can adopt a third-party platform and can also be self-built. On the basis, all local resource addresses which do not conform to the ONIX specification and are contained in the intermediate file are replaced by corresponding Uniform Resource Identifiers (URIs) which conform to the ONIX specification, so that the intermediate file is normalized, and all contents conform to the ONIX specification.
In the case where the intermediate file does not include the local resource address, the above-described resource conversion process is not necessary for the intermediate file.
And 105, performing preset synthesis processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information.
After the intermediate file is subjected to normalization processing to obtain the processing result file, the processing result file and the ONIX template file are subjected to predetermined synthesis processing in the step, so that an ONIX standard file corresponding to the target product information is obtained.
Specifically, the performing of the predetermined synthesis processing on the processing result file and the ONIX template file includes: creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file; and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
In practical implementation of the present invention, automated function implementation may be performed on each processing step of the scheme of the present invention in advance, so that, when there is a need for generating an ONIX standard file of a certain product/a certain batch of products, a user only needs to provide product information of the certain product/the certain batch of products where the need for generating the ONIX standard file exists (for example, inputting required target product information through a graphical interactive interface, etc.), and trigger an automated generation flow of the ONIX standard file (refer to a brief flow diagram shown in fig. 4), so as to quickly generate the required ONIX standard file.
According to the scheme, the method for rapidly generating the ONIX standard file comprises the steps of positioning each layer of element in the ONIX specification by adopting a preset path language (such as XPath), converting target product information into an intermediate file with at least part of content meeting the ONIX specification according to the path file containing the path information of each layer of element obtained by positioning, normalizing the intermediate file to enable all the content to meet the ONIX specification, and finally rapidly generating the ONIX standard file corresponding to the target product information through template synthesis. Therefore, the automatic implementation scheme for rapidly generating the ONIX standard file is realized, when the scheme is utilized, a user only needs to provide the information of the target product to be converted and triggers the generation process of the ONIX standard file to rapidly generate the ONIX standard file, the document structure/hierarchical structure of the ONIX specification does not need to be considered, and the technical problems that the process is complex, the efficiency is relatively low and the like when the ONIX standard file is generated in the prior art are effectively solved.
Example two
In the second embodiment of the present invention, referring to a flowchart of a method for quickly generating an ONIX standard file shown in fig. 5, after the step 102, the method may further include:
step 102', verifying the correctness of the ONIX template file according to a predetermined verification specification and using a corresponding verification tool.
The embodiment provides a verification scheme for verifying the correctness of the obtained ONIX template file.
The corresponding Schema file can be downloaded from the official website, and then the correctness of the ONIX template file can be verified by using an XMLSPY tool based on the downloaded Schema file.
Specifically, the ONIX template file only contains ONIX data of a product part and lacks corresponding sender and receiver data during information sending, so that the data of the sender and the receiver required during information sending can be supplemented by adding a header node below an onixmessage root node of the ONIX template file, for example, the header node of the sender and the header node of the receiver are specifically added, on the basis, a corresponding tool, for example, an XMLSPY tool, is used for verifying the correctness of the node hierarchical structure of the ONIX template file by using the Schema specification, and the supplemented information can be deleted after the subsequent verification is completed.
According to the method and the device for generating the ONIX standard file, the accuracy of the hierarchical structure of each node in the ONIX template file can be effectively ensured by verifying the ONIX template file, and a foundation is laid for the generation of the subsequent ONIX standard file.
EXAMPLE III
The embodiment provides an apparatus for rapidly generating an ONIX standard file, referring to a schematic structural diagram of the apparatus for rapidly generating an ONIX standard file shown in fig. 6, the apparatus includes:
a first obtaining unit 61, configured to obtain target product information to be converted; a second obtaining unit 62, configured to obtain an ONIX template file in a predetermined file format created according to the ONIX specification, and a path file in a predetermined path language format created according to the ONIX specification; wherein the ONIX template file comprises: the path file comprises a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, wherein the path file comprises path information of each element established according to a hierarchical relation of each element provided in the ONIX specification; a conversion unit 63, configured to convert, according to the path file, the target product information into an intermediate file, where at least part of the content of the intermediate file conforms to an ONIX specification; wherein the intermediate file comprises: each element node which accords with the path information in the path file and is instantiated based on the target product information; the processing unit 64 is configured to perform normalization processing on the intermediate file when only part of the contents of the intermediate file meet an ONIX specification, so as to obtain a processing result file of which all the contents meet the ONIX specification; and the synthesizing unit 65 is configured to perform predetermined synthesizing processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information.
In an implementation manner of the embodiment of the present invention, the first obtaining unit is further configured to: and collecting target product information and generating a form file containing the target product information.
In an implementation manner of the embodiment of the present invention, the creating process of the ONIX template file and the path file acquired by the second acquiring unit includes: according to ONIX specification, an ONIX template file is created by adopting an extensible markup language XML file format; and establishing path information of each element by adopting XML path language Xpath according to the hierarchical relation of each element provided by the ONIX specification to obtain a path file.
In an implementation manner of the embodiment of the present invention, the processing unit is further configured to: uploading at least one local resource corresponding to at least one local resource address in the intermediate file to a network space, and obtaining a Uniform Resource Identifier (URI) corresponding to the uploaded resource in the network space; and replacing at least one local resource address in the intermediate file with a corresponding Uniform Resource Identifier (URI).
In an implementation manner of the embodiment of the present invention, the synthesis unit is further configured to: creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file; and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
In an implementation manner of the embodiment of the present invention, referring to fig. 7, the apparatus further includes a verification unit 66, configured to verify the correctness of the ONIX template file according to a predetermined verification specification and using a corresponding verification tool.
It should be noted that, the description of the apparatus for rapidly generating an ONIX standard file related to this embodiment is similar to the description of the method above, and the advantageous effects of the method are described.
In summary, the scheme for rapidly generating the ONIX standard file of the invention has the following advantages: the scheme of the invention positions each hierarchy node in the ONIX standard through XPath, and converts the target product information into the ONIX intermediate file by using a recursion scheme according to the path file obtained by positioning, and on the basis, the rapid generation of the ONIX standard file corresponding to the target product information is realized through resource check and template combination. By adopting the scheme of the invention, a user can quickly generate the ONIX standard file only by providing the information of the target product to be converted and triggering the generation process of the ONIX standard file without considering the document structure/hierarchical structure of the ONIX standard, can quickly generate the ONIX file by occupying less system resources under the condition of not depending on the document structure, and effectively solves the technical problems of complex process, relatively low efficiency and the like when the ONIX standard file is generated in the prior art. Meanwhile, since the XPath is adopted to describe the node path, the secondary development efficiency can be greatly improved.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
For convenience of description, the above system or apparatus is described as being divided into various modules or units by function, respectively. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Finally, it is further noted that, herein, relational terms such as first, second, third, fourth, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for rapidly generating an ONIX standard file is characterized by comprising the following steps:
obtaining target product information to be converted;
acquiring an ONIX template file in a preset file format created according to the ONIX specification and a path file in a preset path language format created according to the ONIX specification; wherein the ONIX template file comprises: the path file comprises a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, wherein the path file comprises path information of each element established according to a hierarchical relation of each element provided in the ONIX specification;
converting the target product information into an intermediate file at least part of content of which conforms to ONIX specification according to the path file; wherein the intermediate file comprises: each element node which accords with the path information in the path file and is instantiated based on the target product information;
when only part of contents of the intermediate file conform to ONIX specifications, carrying out standardization processing on the intermediate file to obtain a processing result file with all contents conforming to ONIX specifications;
performing predetermined synthesis processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information;
wherein, only part of the content of the intermediate file conforms to ONIX specification as follows: determining that at least one local resource address which does not conform to ONIX specification exists in the intermediate file through resource check;
then, when only part of the content of the intermediate file conforms to the ONIX specification, performing normalization processing on the intermediate file includes: uploading at least one local resource corresponding to at least one local resource address in the intermediate file to a network space, and obtaining a Uniform Resource Identifier (URI) corresponding to the uploaded resource in the network space; and replacing at least one local resource address in the intermediate file with a corresponding Uniform Resource Identifier (URI).
2. The method of claim 1, wherein the obtaining target product information to be converted comprises:
and collecting target product information and generating a form file containing the target product information.
3. The method of claim 1, wherein creating an ONIX template file in a predetermined file format and a path file in a predetermined path language format in accordance with the ONIX specification comprises:
according to ONIX specification, an ONIX template file is created by adopting an extensible markup language XML file format;
and establishing path information of each element by adopting XML path language Xpath according to the hierarchical relation of each element provided by the ONIX specification to obtain a path file.
4. The method of claim 1, wherein the performing a predetermined synthesis process on the processing result file and the ONIX template file comprises:
creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file;
and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
5. The method of claim 1, wherein after obtaining the ONIX template file in a predetermined file format created according to the ONIX specification, further comprising:
and verifying the correctness of the ONIX template file according to a preset verification specification by using a corresponding verification tool.
6. An apparatus for rapidly generating an ONIX standard file, comprising:
the first acquisition unit is used for acquiring target product information to be converted;
a second obtaining unit, configured to obtain an ONIX template file in a predetermined file format created according to the ONIX specification, and a path file in a predetermined path language format created according to the ONIX specification; wherein the ONIX template file comprises: the path file comprises a root node corresponding to a root element in the ONIX specification and a namespace of the ONIX specification, wherein the path file comprises path information of each element established according to a hierarchical relation of each element provided in the ONIX specification;
the conversion unit is used for converting the target product information into an intermediate file at least part of content of which conforms to ONIX specification according to the path file; wherein the intermediate file comprises: each element node which accords with the path information in the path file and is instantiated based on the target product information;
the processing unit is used for carrying out standardization processing on the intermediate file when only part of contents of the intermediate file conform to ONIX specifications to obtain a processing result file with all contents conforming to ONIX specifications;
a synthesizing unit, configured to perform predetermined synthesizing processing on the processing result file and the ONIX template file to obtain an ONIX standard file corresponding to the target product information;
wherein, only part of the content of the intermediate file conforms to ONIX specification as follows: determining that at least one local resource address which does not conform to ONIX specification exists in the intermediate file through resource check;
the processing unit is further configured to: uploading at least one local resource corresponding to at least one local resource address in the intermediate file to a network space, and obtaining a Uniform Resource Identifier (URI) corresponding to the uploaded resource in the network space; and replacing at least one local resource address in the intermediate file with a corresponding Uniform Resource Identifier (URI).
7. The apparatus of claim 6, wherein the first obtaining unit is further configured to:
and collecting target product information and generating a form file containing the target product information.
8. The apparatus of claim 6, wherein the creation process of the ONIX template file and the path file acquired by the second acquisition unit comprises:
according to ONIX specification, an ONIX template file is created by adopting an extensible markup language XML file format; and establishing path information of each element by adopting XML path language Xpath according to the hierarchical relation of each element provided by the ONIX specification to obtain a path file.
9. The apparatus of claim 6, wherein the synthesis unit is further configured to:
creating a template copy of the ONIX template file, the template copy being consistent with the contents of the ONIX template file; and filling the file content of the processing result file to a root node of the template copy to obtain an ONIX standard file corresponding to the target product information.
10. The apparatus of claim 6, further comprising:
and the verification unit is used for verifying the correctness of the ONIX template file according to a preset verification specification by using a corresponding verification tool.
CN201710178592.XA 2017-03-23 2017-03-23 Method and device for quickly generating ONIX standard file Active CN106951399B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710178592.XA CN106951399B (en) 2017-03-23 2017-03-23 Method and device for quickly generating ONIX standard file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710178592.XA CN106951399B (en) 2017-03-23 2017-03-23 Method and device for quickly generating ONIX standard file

Publications (2)

Publication Number Publication Date
CN106951399A CN106951399A (en) 2017-07-14
CN106951399B true CN106951399B (en) 2020-05-19

Family

ID=59472717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710178592.XA Active CN106951399B (en) 2017-03-23 2017-03-23 Method and device for quickly generating ONIX standard file

Country Status (1)

Country Link
CN (1) CN106951399B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107632831B (en) * 2017-09-22 2020-07-31 厦门集微科技有限公司 Method and device for quickly standardizing front-end codes
CN109086260B (en) * 2018-08-29 2020-01-14 中国标准化研究院 Food data processing method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7017112B2 (en) * 2003-02-28 2006-03-21 Microsoft Corporation Importing and exporting markup language data in a spreadsheet application document
CN103559322B (en) * 2013-11-22 2017-11-17 北大医疗信息技术有限公司 Document format conversion method
CN104991785A (en) * 2015-08-03 2015-10-21 江苏优聚思信息技术有限公司 Standardized clinical data service support system and method

Also Published As

Publication number Publication date
CN106951399A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
US8850454B2 (en) Method and computer program product for integrating a first application providing a B2B gateway and one or more second applications
CN110781082B (en) Method, device, medium and equipment for generating test case of interface
US9898263B2 (en) System and method for resource-definition-oriented software generation and development
US8108767B2 (en) Electronic data interchange transaction set definition based instance editing
CN104156313A (en) Method for automatically generating Web service testing case
US20080235261A1 (en) Generating a new file using instance information
JP2009509271A (en) Apparatus and method for data profiling based on composition of extraction, transformation and reading tasks
JP2005521159A (en) Dynamic generation of schema information for data description languages
US20060017947A1 (en) Method and system for an XML-driven document conversion service
CN110705237A (en) Automatic document generation method, data processing device, and storage medium
CN106951399B (en) Method and device for quickly generating ONIX standard file
Krogstie Capturing enterprise data integration challenges using a semiotic data quality framework
Golzarpoor et al. Improving construction industry process interoperability with Industry Foundation Processes (IFP)
US20200117644A1 (en) Placeholder case nodes and child case nodes in a case model
CN114168109A (en) Data processing method and device, electronic equipment and storage medium
Lanza et al. Relating structural test and FEA data with STEP AP209
CN110442331B (en) Method and system for automatically building code frame
Paternò et al. Exploiting web service annotations in model-based user interface development
CN113590115A (en) Method and device for automatically generating service system code
Zhu et al. A unified bill of material based on STEP/XML
CN108984676B (en) Electronic book cross-terminal self-adaptive display system and method based on XML
CN113032353A (en) Data sharing method, system, electronic device and medium
EP4354281A1 (en) Converting an api into a graph api
Zaupa et al. A Service-oriented Process to Develop Web Applications.
CN113780903B (en) Asset object management method and device, electronic equipment and computer storage medium

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
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method and device for quickly generating ONIX standard files

Effective date of registration: 20220811

Granted publication date: 20200519

Pledgee: Beijing Beitou Financing Guarantee Co.,Ltd.

Pledgor: BEIJING JETSEN TECHNOLOGY Co.,Ltd.

Registration number: Y2022110000176

PE01 Entry into force of the registration of the contract for pledge of patent right