[go: up one dir, main page]

CN113568622B - Method, device and electronic device for converting code - Google Patents

Method, device and electronic device for converting code Download PDF

Info

Publication number
CN113568622B
CN113568622B CN202110900202.1A CN202110900202A CN113568622B CN 113568622 B CN113568622 B CN 113568622B CN 202110900202 A CN202110900202 A CN 202110900202A CN 113568622 B CN113568622 B CN 113568622B
Authority
CN
China
Prior art keywords
file
java
code
extensible markup
markup language
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
CN202110900202.1A
Other languages
Chinese (zh)
Other versions
CN113568622A (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.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC 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 Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110900202.1A priority Critical patent/CN113568622B/en
Publication of CN113568622A publication Critical patent/CN113568622A/en
Application granted granted Critical
Publication of CN113568622B publication Critical patent/CN113568622B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

本公开提供了一种转换代码的方法、装置和电子设备,应用于物联网或金融领域等。该方法用于将第一程序支持的代码转换为第二程序支持的代码,其中,第一程序包括第一可扩展标记语言文件和Java文件,第一可扩展标记语言文件包括结构化查询语言代码,上述方法包括:获取第一可扩展标记语言文件和Java文件;以及通过可扩展标记语言解析方法重构结构化查询语言代码,并且通过模板生成方法重构Java文件中Java代码,得到第二程序的文件夹,第二程序的文件夹包括重构后的结构化查询语言代码和重构后的Java代码。

The present disclosure provides a method, device and electronic device for converting codes, which are applied to the Internet of Things or financial fields, etc. The method is used to convert a code supported by a first program into a code supported by a second program, wherein the first program includes a first extensible markup language file and a Java file, and the first extensible markup language file includes a structured query language code, and the above method includes: obtaining the first extensible markup language file and the Java file; and reconstructing the structured query language code by an extensible markup language parsing method, and reconstructing the Java code in the Java file by a template generation method, to obtain a folder of the second program, and the folder of the second program includes the reconstructed structured query language code and the reconstructed Java code.

Description

Method and device for converting codes and electronic equipment
Technical Field
The present disclosure relates to the field of internet of things and financial technologies, and more particularly, to a method, an apparatus, and an electronic device for converting codes.
Background
Some companies run programs developed based on dynamic web page development technology (such as Java SERVER PAGES, abbreviated as JSP) on a production environment, and the JSP technology is a technology with front-back and back-end separation. However, the front-end and back-end separation can effectively reduce the pressure of the server and help reduce development difficulty.
In the process of realizing the conception of the present disclosure, the applicant finds that at least the following problems exist in the related art, namely, the transplanting cost between the program developed based on the JSP technology and the program developed by the existing front-end and back-end separation technology is high.
Disclosure of Invention
In view of this, the present disclosure provides a method, apparatus, and electronic device for transcoding to reduce migration costs between programs developed based on JSP technology and programs developed by existing front-end and back-end separation technology.
An aspect of the present disclosure provides a method for converting code, for converting code supported by a first program into code supported by a second program, where the first program includes a first extensible markup language file and a Java file, the first extensible markup language file includes a structured query language code, the method includes obtaining the first extensible markup language file and the Java file, reconstructing the structured query language code by an extensible markup language parsing method, and reconstructing the Java code in the Java file by a template generation method, to obtain a folder of the second program, where the folder of the second program includes the reconstructed structured query language code and the reconstructed Java code.
According to the embodiment of the disclosure, the first extensible markup language file comprises a business statement and a template statement, the business statement and the template statement can generate a structured query language code, and the reconstruction of the structured query language code through an extensible markup language analysis method comprises the steps of respectively analyzing the business statement and the template statement by using an extensible markup language file analyzer to obtain analysis results, generating a second extensible markup language file aiming at the analysis results according to the requirement of a persistence format, and generating a Java file corresponding to the second extensible markup language file under a data access object folder.
According to the embodiment of the disclosure, an extensible markup language file parser is used for respectively parsing a business sentence and a template sentence to obtain a parsing result, wherein the parsing result comprises parsing the template sentence according to file traversal, the template sentence is a sentence obtained by parsing a first extensible markup language file, parsing the business sentence according to file traversal, storing the template sentence and the business sentence in a mapping set in an associated manner, and performing joint parsing on the business sentence and the template sentence to obtain a reconstructed structured query language code.
According to an embodiment of the present disclosure, generating a second extensible markup language file for the parsing result according to the persistence requirement format includes storing the reconstructed structured query language code as a second extensible markup language file satisfying the persistence format requirement.
Generating Java files corresponding to the second extensible markup language files under the data access object folder according to the embodiment of the disclosure comprises generating Java files corresponding to the second extensible markup language files meeting the requirements of the persistence format under the data access object folder for each second extensible markup language file meeting the requirements of the persistence format.
According to an embodiment of the present disclosure, reconstructing Java code in a Java file by a template generation method includes parsing the Java code to generate a Java file in a service folder and generating a Java file corresponding to the Java file in the service folder in a program interface folder.
According to an embodiment of the disclosure, parsing Java codes to generate Java files in a service folder includes parsing Java files in a first program by file traversal, converting calling methods of structured query language codes in Java files in the first program into methods corresponding to the calling methods of the structured query language codes under a data access object folder, and generating Java files in the service folder based on the methods corresponding to the calling methods of the structured query language codes.
According to an embodiment of the present disclosure, generating Java files in a program interface folder that correspond to Java files in a service folder includes generating Java files in the program interface file that correspond to Java files in the service folder after generating at least one Java file in the service folder.
According to an embodiment of the present disclosure, the method further includes modifying the Java files in the service folder in response to a user operation after generating the Java files in the service folder.
An aspect of the present disclosure provides an apparatus for converting code supported by a first program into code supported by a second program, where the first program includes a first extensible markup language file and a Java file, the first extensible markup language file includes a structured query language code, and the apparatus includes a file acquisition module and a code reconstruction module. The file acquisition module is used for acquiring the first extensible markup language file and the Java file, the code reconstruction module is used for reconstructing the structured query language code through an extensible markup language analysis method, reconstructing the Java code in the Java file through a template generation method and obtaining a folder of the second program, and the folder of the second program comprises the reconstructed structured query language code and the reconstructed Java code.
Another aspect of the disclosure provides an electronic device comprising one or more processors and a storage device for storing executable instructions that when executed by the processors implement the method as above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed, are configured to implement a method as above.
Another aspect of the present disclosure provides a computer program comprising computer executable instructions which when executed are for implementing a method as above.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
FIG. 1 schematically illustrates an exemplary system architecture of a method, apparatus, and electronic device in which transcoding may be applied, according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a method of transcoding according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow chart of a method of reconstructing structured query language code, according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a block diagram of an XML parser in accordance with an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart of a method of generating Java files in a service folder in accordance with an embodiment of the present disclosure;
FIG. 6 schematically illustrates a block diagram of FREEMARKER, according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a block diagram of an apparatus for transcoding in accordance with an embodiment of the present disclosure, and
Fig. 8 schematically illustrates a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). The terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more features.
To facilitate an understanding of the embodiments of the present disclosure, a description is first given of some concepts to which the present disclosure relates.
The transmission control protocol (Transmission Control Protocol, TCP for short) is a connection-oriented, reliable, byte-stream based transport layer communication protocol. TCP is intended to accommodate a layered protocol hierarchy that supports multiple network applications.
The hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP for short), is a simple request-response protocol, which typically runs on top of TCP.
Java is an object-oriented programming language, not only absorbs various advantages of the C++ language, but also abandons concepts such as multi-inheritance and pointers which are difficult to understand by the C++ force, so that the Java language has two characteristics of powerful functions, simplicity and easiness in use. Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multithreading, dynamics and the like.
JavaScript, abbreviated as JS, is a lightweight, interpreted or just-in-time compiled programming language with function priority.
Extensible markup language (Extensible Markup Language, XML for short) is a subset of the standard generic markup language used to mark electronic files as structured markup language.
The JS object numbered musical notation (JavaScript Object Notation, JSON for short) is a lightweight data exchange format. It stores and represents data in a text format that is completely independent of the programming language.
The Representational STATE TRANSFER, abbreviated as RESTFUL, is a design style and development mode of a network application program, and can be defined by using XML format or JSON format based on HTTP.
An application program interface (Application Programming Interface, abbreviated as API) is a predefined interface (e.g., function, HTTP interface) or a convention that refers to the engagement of different components of a software system.
The front end is separated from the back end, and the front end can refer to a web server and is responsible for returning user page information. The backend may refer to an application server, responsible for handling business logic. The front-end and back-end separate hypertext markup language (Hyper Text Markup Language, abbreviated HTML) pages, which may refer to the front-end, call the back-end's restul API interface through asynchronous JavaScript and XML (Asynchronous JavaScript And XML And HTML, abbreviated AJAX) and interact using JSON data.
JSP is known as Java SERVER PAGES, which is a dynamic web page development technology that uses JSP tags to insert Java code in HTML web pages. Is a technology with front and back ends not separated, and has no distinction between the front and back ends.
Spring is an open-source lightweight Java back-end development framework and has the two core characteristics of control inversion and section-oriented. The method is mainly used for back-end service development.
Some companies are now running programs written using JSP technology on a production environment. These procedures are basically old in technology, the ideas fall behind, and maintenance is difficult. However, if the program written based on the JSP technology is reconstructed by using the new technology, the method is time-consuming and labor-consuming and has high cost. For example, the JSP technology development system is basically incompatible with the existing development system with front-end and back-end separation, and the transplantation cost is high. In the related art, JSP codes can be reconstructed into spring codes through manual reconstruction by manpower, so that operators are required to meet the requirements of both JSP technology and spring technology, and high requirements are put on programming literacy of the operators. For example, an operator needs to analyze the code of the JSP system before performing manual reconstruction. Such a method requires a lot of labor cost, and is prone to cause program defects (bugs) during the reconstruction process, resulting in economic loss.
In the related art, the mainstream code conversion method mainly relies on manual operation to reconstruct JSP code to spring code, and the drawbacks include the following.
For example, the automation degree is low, and code reconstruction can only be carried out by manpower, which is time-consuming and labor-consuming. The knowledge of the service needs to be known, and the reconstruction efficiency is low.
For example, the operator is required to be skilled in JSP and front-end and back-end separation technology to reconstruct, and the requirement on the operator is high.
For example, there is a problem in that a human operation may cause problems due to subjective cognition of a person, and the problems also need to be solved by consuming manpower.
In summary, many companies do not have the incentive to reconstruct JSP code.
To at least partially ameliorate the above pain, embodiments of the present disclosure provide a method, apparatus, and electronic device for transcoding. The method for transcoding comprises a file acquisition process and a code reconstruction process. In the file acquisition process, a first extensible markup language file and a Java file are acquired. After the file acquisition process is completed, a code reconstruction process is carried out, the structured query language code is reconstructed through an extensible markup language analysis method, java codes in Java files are reconstructed through a template generation method, and a folder of a second program is obtained, wherein the folder of the second program comprises the reconstructed structured query language code and the reconstructed Java codes.
The method, the device and the electronic equipment for converting codes effectively improve the defect of complicated and difficult reconstruction of JSP codes, provide a technical scheme which is efficient, convenient and capable of automatically reconstructing the JSP codes into spring codes, effectively improve the reconstruction efficiency and rapidly convert simple and clear JSP codes into spring codes.
The method, the device and the electronic equipment for converting codes provided by the embodiment of the disclosure can be used in the field of the internet of things in the related aspect of converting codes, and can also be used in various fields except the field of the internet of things, such as the financial field, and the application fields of the method, the device and the electronic equipment for converting codes provided by the embodiment of the disclosure are not limited.
Fig. 1 schematically illustrates an exemplary system architecture of a method, apparatus and electronic device in which transcoding may be applied according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 may include a number of gateways, routers, hubs, network cables, etc. to provide a medium for communication links between the end devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user can interact with other terminal devices and the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or transmit information or the like, such as receiving Java files, transmitting codes or the like. The terminal devices 101, 102, 103 may be installed with various communication client applications. For example, web browser applications, drawing class applications, software development class applications, banking class applications, government class applications, monitoring class applications, search class applications, office class applications, instant messaging tools, mailbox clients, social platform software, and the like (just examples). For example, the user may perform transcoding using the terminal device 101 or send a transcoding instruction or the like to the server side.
Terminal devices 101, 102, 103 include, but are not limited to, smartphones, virtual reality devices, augmented reality devices, tablet computers, laptop computers, desktop computers, and the like that are capable of using a web browser or client.
The server 105 may receive the request and process the request, and may specifically be a storage server, a background management server, a server cluster, and the like. For example, server 105 may store programs developed based on JSP technology. For example, the server 105 may be used to run a transcoded program or the like.
It should be noted that, the method for generating a message provided by the embodiments of the present disclosure may be generally performed by the terminal devices 101, 102, 103 or the server 105. Accordingly, the apparatus for generating a message provided in the embodiments of the present disclosure may be generally disposed in the terminal device 101, 102, 103 or the server 105. The method of generating a message provided by the embodiments of the present disclosure may also be performed by a server or a cluster of servers that are different from the server 105 and that are capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks and servers is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically illustrates a flow chart of a method of transcoding according to an embodiment of the present disclosure. The method for converting codes is used for converting codes supported by a first program into codes supported by a second program, wherein the first program comprises a first extensible markup language file and a Java file, and the first extensible markup language file comprises a structured query language code.
As shown in FIG. 2, the method for transcoding may include operations S210-S220.
In operation S210, a first extensible markup language file and a Java file are acquired.
In this embodiment, a Java folder and a first extensible markup language file including a structured query language (Structured Query Language, abbreviated as SQL) statement may be obtained from a program installed in an electronic device. Two types of folders, namely 1, XML folders containing SQL sentences, can be included in programs developed based on the JSP technology. 2. Java folders.
The programs developed based on the spring technology can comprise a plurality of types of folders 1 and a program interface folder (such as a controller folder) for storing program interfaces. 2. A service type folder (e.g., a service folder) for storing service-related codes. 3. A data access Object (DATA ACCESS Object, DAO) type folder (e.g., DAO folder, each XML file in which an XML file generates a Java file). 4. An extensible markup language type folder (e.g., an XML folder) for storing SQL statements.
In operation S220, the structured query language code is reconstructed by the extensible markup language parsing method, and Java codes in the Java file are reconstructed by the template generating method, so as to obtain a folder of the second program, where the folder of the second program includes the reconstructed structured query language code and the reconstructed Java codes.
Specifically, the embodiment includes two types of operations, on one hand, parsing and reconstructing the SQL, and on the other hand, parsing and reconstructing the Java. The program developed based on the JSP technology can be reconstructed into the spring program by combining two types of operations. It should be noted that, during the conversion process, a small amount of manual processing may be required to operate.
Aiming at the characteristics of the JSP codes, the JSP codes are divided into two types of XML files and Java files in the embodiment, wherein the SQL codes are reconstructed by using an XML parsing method and the Java codes are reconstructed by using a template generating method. By the method, spring code engineering can be quickly constructed, a large amount of workload is saved, and various problems possibly caused by manual reconstruction are reduced.
In some embodiments, the first extensible markup language file includes business statements and template statements, the business statements and template statements capable of generating structured query language code.
Fig. 3 schematically illustrates a flow chart of a method of reconstructing structured query language code, according to an embodiment of the disclosure.
As shown in fig. 3, reconstructing the structured query language code by the extensible markup language parsing method may include operations S301 to S302.
In operation S301, the business statement and the template statement are parsed using the extensible markup language file parser, respectively, to obtain a parsed result. For example, the extensible markup language file parser may be a Dom4j, dom, etc. parser. The Dom4j is a Java XML application interface (API), which is a jdom upgrade for reading and writing XML files.
In operation S302, a second extensible markup language file for the parsing result is generated according to the persistence format requirement, and a Java file corresponding to the second extensible markup language file is generated under the data access object folder.
For example, the persistent format requirement may be a format requirement of MyBatis, or the like. MyBatis is a persistent layer framework that supports custom SQL, stored procedures, and high-level mapping. MyBatis avoids nearly all Java database connection (Java Database Connectivity, JDBC) codes and manual set parameters and get result sets. MyBatis can use simple XML or annotations to configure and map native information, mapping the interface and generic Java objects of Java (Plan Ordinary Java Object, POJOs for short) to records in the database.
In some embodiments, the above-described process may be implemented by an SQL parse-reconstruct module. For example, the SQL parsing reconstruction module uses Dom4j (an XML parsing and generation tool) as a specific implementation method based on XML parsing technology. Rewriting an XML file of the JSP into an XML file readable by mybatis (a persistence tool), and putting the XML file into an XML folder; and simultaneously generating a Java file in a corresponding dao folder, which is used for matching with the XML file of mybatis.
Specifically, the SQL parsing reconstruction module first traverses all XML files in a program developed based on JSP technology. XML files in programs developed based on JSP technology are mainly divided into business sentences and template sentences, and the business sentences and the template sentences are combined to generate readable SQL sentences. And respectively analyzing the business statement and the template statement by using the Dom4j, and performing formatting storage. And then regenerating the XML file according to the format required by mybatis, and generating Java files under the corresponding dao folder while generating the XML file.
Fig. 4 schematically illustrates a block diagram of an XML parser in accordance with an embodiment of the present disclosure.
As shown in FIG. 4, the XML parser may include a DOM class, a SAX class, and a JAXP class. The DOM class may be parsed by a DOM4j parser or a DOM parser. The SAX class may be parsed using a SAX parser. In addition, JAXP classes can also be parsed using a DOM parser and a SAX parser.
Dom4j is an open source XML parsing package, which is a readily available, open source library for XML, XPath, and XSLT. It applies to the Java platform, adopts the Java set framework and fully supports DOM, SAX and JAXP.
The Dom4j implements its functionality based primarily on the XML-Dom model. The main interfaces of Dom4j are all defined in the package org.dom4j. For example, attribute Attribute defines attributes of XML. Branch Branch is a node such as an XML Element (Element) and document that can contain child nodes.
In some embodiments, the business statement and the template statement are parsed using an extensible markup language file parser, respectively, to obtain a parsing result comprising the following operations.
The method comprises the steps of firstly traversing and analyzing template sentences according to files, wherein the template sentences are sentences obtained by analyzing a first extensible markup language file, traversing and analyzing business sentences according to files, and storing the template sentences and the business sentences in a mapping set in an associated mode.
And then, the service statement and the template statement are jointly analyzed to obtain a reconstructed structured query language code.
The XML parsing using Dom4j is exemplified below.
With respect to parsing an XML document.
The reading and writing of XML documents mainly depends on org.Dom4j.io package, wherein two different modes of DOMReader and SAXReader are provided, and the calling modes are all called by means of interfaces.
Reading XML from file, inputting file name, returning XML document
public Document read(String fileName)throws MalformedURLException,DocumentException{
SAXReader reader=new SAXReader();
Document document=reader.read(new File(fileName));
return document;
}
The read method of the reader is reloaded, and can be read from InputStream, file, url and other different sources. The resulting Document object represents the entire XML.
The character codes read are converted according to the codes defined by the XML file header. If a scrambling problem is encountered, the code names of all places need to be kept consistent.
The next step after reading is to obtain the Root node.
public Element getRootElement(Document doc){
return doc.getRootElement();
}
Next, the XML tree is traversed.
Specifically, the nodes of the XML tree may be traversed by any one of enumeration, recursion, and guests.
For example, 1. Enumeration (Iterator).
All child nodes are enumerated/enumerated
for(Iterator i=root.elementIterator();i.hasNext();){
Element element=(Element)i.next();
//do something
}
Node with the name foo
for(Iterator i=root.elementIterator(foo);i.hasNext();){
Element foo=(Element)i.next();
//do something
}
The// enumeration properties
for(Iterator i=root.attributeIterator();i.hasNext();){
Attribute attribute=(Attribute)i.next();
//do something
}
E.g., 2. Recursion.
Recursion may also employ Iterator as an enumeration means, but additional practices are provided in the document
public void treeWalk(){
treeWalk(getRootElement());
}
public void treeWalk(Element element){
for(int i=0,size=element.nodeCount();i<size;i++){
Node node=element.node(i);
if(node instanceof Element){
treeWalk((Element)node);
}else{//do something....
}
}
}
For example, a monitor mode.
The support of the DOM4J to Visitor can greatly reduce the code amount, and only one class needs to be self-defined to realize the Visitor interface.
public class MyVisitor extends VisitorSupport{
public void visit(Element element){
System.out.println(element.getName());
}
public void visit(Attribute attr){
System.out.println(attr.getName());
}
}
Concerning the call, root.
The Visitor interface provides a variety of reloads of Visit () that will be accessed in different ways depending on the objects in the XML. This Visitor is an automatic traversal of all child nodes. If root, accept (MyVisitor), the child node will be traversed.
With respect to the conversion of strings with XML.
Sometimes conversion of strings into XML or vice versa is often used.
Xml conversion character string
Document document=...;
String text=document.asXML();
String conversion of/character XML
String text=<name>James</name></person>;
Document document=DocumentHelper.parseText(text);
For example, transforming XML with XSLT
public Document styleDocument(
Document document,
String stylesheet
)throws Exception{
//load the transformer using JAXP
TransformerFactory factory=TransformerFactory.newInstance();
Transformer transformer=factory.newTransformer(
new StreamSource(stylesheet)
);
//now lets style the given document
DocumentSource source=new DocumentSource(document);
DocumentResult result=new DocumentResult();
transformer.transform(source,result);
//return the transformed document
Document transformedDoc=result.getDocument();
return transformedDoc;
}
With respect to creating XML.
Creating XML may be a work before writing a file.
public Document createDocument(){
Document document=DocumentHelper.createDocument();
Element root=document.addElement("root");
Element author1=
root
.addElement(author)
.addAttribute(name,James)
.addAttribute(location,UK)
.addText(James Strachan);
Element author2=
root
.addElement(author)
.addAttribute(name,Bob)
.addAttribute(location,US)
.addText(Bob McWhirter);
return document;
}
In some embodiments, generating a second extensible markup language file for the parsing result according to the persistence requirement format includes storing the reconstructed structured query language code as a second extensible markup language file that meets the persistence format requirement. For example, XML files stored as mybatis readable
In some embodiments, generating Java files corresponding to the second eXtensible markup language files under the data access object folder includes generating Java files corresponding to the second eXtensible markup language files meeting the requirements of the persistence format under the data access object folder for each of the second eXtensible markup language files meeting the requirements of the persistence format.
In one particular embodiment, reconstructing the structured query language code is accomplished by the following operations.
First, the XML template statement in the JSP program is parsed by using the Dom4j according to the file traversal, and is stored in a map.
Then, XML business statements in the JSP program are parsed by file traversal.
Then, the XML business statement is combined with the XML template statement in the first operation to be resolved in a joint way.
And then, storing the SQL sentence analyzed in the step 2 as an XML file readable by mybatis by using the Dom4 j.
Then, each time an XML file is generated, a corresponding Java file is generated under the dao folder.
In some embodiments, reconstructing Java code in a Java file by a template generation method may include parsing the Java code to generate Java files in a service folder and generating Java files corresponding to Java files in a service folder in a program interface folder.
Specifically, code generation based on a template method can be realized through a Java parsing reconstruction module. For example, FREEMARKER (a template code generation method) is used for Java code generation. Similar to the SQL parsing method, the template method is used for parsing Java codes, and the Java codes are parsed to generate Java files in a service folder, and simultaneously a Java file is correspondingly generated in a controller folder.
Fig. 5 schematically illustrates a flowchart of a method of generating Java files in a service folder according to an embodiment of the present disclosure.
As shown in fig. 5, parsing the Java code to generate the Java file in the service folder may include operations S501 to S503.
In operation S501, java files in the first program are parsed per file traversal.
In operation S502, a calling method of a structured query language code in a Java file in a first program is converted into a method corresponding to the calling method of the structured query language code under a data access object folder.
In operation S503, java files in the service folder are generated based on a method corresponding to the calling method of the structured query language code.
For example, generating Java files in the program interface folder that correspond to Java files in the service folder includes generating Java files in the program interface file that correspond to Java files in the service folder after generating at least one Java file in the service folder.
In some embodiments, the method may further include modifying the Java files in the service folder in response to a user operation after generating the Java files in the service folder. Thus, the adjustment requirements of some complex scenes can be met, and the like.
Fig. 6 schematically illustrates a block diagram FREEMARKER according to an embodiment of the present disclosure.
As shown in FIG. 6, FREEMARKER is a generic tool that is based on the template and the data that needs to be changed and is used to generate output text (HTML web page, email, configuration file, source code, etc.). It is not end-user oriented, but rather a Java class library, a component that can embed programs they develop.
Templates written as FREEMARKER TEMPLATE Language (FTL) are simple, proprietary languages. This means that the data is to be prepared for display in the real programming language, such as database queries and business operations, after which the templates display the data already prepared.
This mode is commonly referred to as the MVC (model view controller) mode, which is a mature mode for dynamic web pages.
The working principle thereof can be as follows.
Assume that an HTML page is required in an application as follows:
The user name in the page (i.e., "XXBC" above) is the name of the visitor logging into this page and the data should come from the database to be updated at any time. "XXBC", "greenmXXX" and links cannot be entered directly in the HTML page, and static HTML code cannot be used. The template may be solved using a template that requires output, the template and the static page being identical, the template may contain some instructions FREEMARKER to turn it into dynamic content. Such as:
The template file is stored on a network (Web) server, and FREEMARKER is involved in executing when someone accesses the page, then the template is dynamically converted, the parts of the template are replaced with the latest data content, $. The visitor's Web browser receives content such as the first HTML instance (i.e., HTML code without FREEMARKER instructions), nor does the visitor perceive FREEMARKER for use at the server side. It should be noted that the template file stored in the Web server side is not modified. Substitutions also occur only in the response of the Web server.
The entirety of the data prepared for the template is referred to as a data model. The data model is a tree structure (e.g., folders and files in a tree topology).
For example, these values may be selected from the data model, using the user and latestproduct. In analogy to a tree structure, the data model is like a file system, "(root)" and latestProduct correspond to directories (folders), and user, url and name are files in these directories.
In general, as shown in fig. 6, the template and data model are components necessary for FREEMARKER to generate an output, template+data model=output.
In one particular embodiment, reconstructing Java code may include the operations shown below.
First, java files in a JSP program are parsed per file traversal.
Then, the SQL calling method in the Java file analyzed in the previous operation is changed into a corresponding method under the dao folder.
Then, FREEMARKER is used to generate the content analyzed in the previous operation into Java files under the service folder, and if special cases are available, customization improvement can be performed.
Then, each time a Java file under a service folder is generated, a Java file under a controller folder is correspondingly generated.
Through the combined application of the XML analysis method and the template generation method, the basic reconstruction from the JSP program to the spring program can be completed, and then the reconstruction work can be completed under manual adjustment.
According to the method, the device and the electronic equipment for converting codes, which are provided by the embodiment of the disclosure, aiming at the problems of high cost, easy error and the like of manually converting codes, an XML parsing method and a template method are introduced to reconstruct XML files and Java files, so that operators can get rid of a large amount of repeated time-consuming work, labor is saved, efficiency is improved, and meanwhile the occurrence probability of problems is reduced. Saving a lot of cost for enterprises.
For example, by designing a whole set of JSP reconstruction flow, the situation of reconstruction of different JSP items can be multiplexed and rapidly solved.
For example, the XML parsing method and the template method are used for reconstructing XML files and Java files, so that the working efficiency is greatly improved, and the reconstruction cost is reduced.
For example, the customized reconstruction can be performed aiming at special files, the mechanism is flexible, and the reconstruction work is convenient to develop.
Another aspect of the present disclosure provides an apparatus for transcoding. The apparatus is for converting code supported by a first program into code supported by a second program, wherein the first program comprises a first extensible markup language file and a Java file, and the first extensible markup language file comprises structured query language code.
Fig. 7 schematically illustrates a block diagram of an apparatus for transcoding according to an embodiment of the present disclosure.
As shown in fig. 7, the apparatus 700 for transcoding may include a file acquisition module 710 and a code reconstruction module 720.
The file acquisition module 710 is configured to acquire a first extensible markup language file and a Java file.
The code reconstruction module 720 is configured to reconstruct the structured query language code by using an extensible markup language parsing method, and reconstruct the Java code in the Java file by using a template generating method, so as to obtain a folder of the second program, where the folder of the second program includes the reconstructed structured query language code and the reconstructed Java code.
It should be noted that, the implementation manner, the solved technical problems, the realized functions and the obtained technical effects of each module/unit and the like in the apparatus portion embodiment are the same as or similar to the implementation manner, the solved technical problems, the realized functions and the obtained technical effects of each corresponding step in the method portion embodiment, and are not described in detail herein.
Any number of the modules, units, or at least some of the functionality of any number of the modules, units, or units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging the circuits, or in any one of or in any suitable combination of three of software, hardware, and firmware. Or one or more of the modules, units according to embodiments of the present disclosure may be at least partially implemented as computer program modules which, when executed, may perform the corresponding functions.
For example, any of the file acquisition module 710 and the code reconstruction module 720 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the file acquisition module 710 and the code reconstruction module 720 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware, such as any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Or at least one of the file acquisition module 710 and the code reconstruction module 720 may be at least partially implemented as computer program modules which, when executed, perform the corresponding functions.
Another aspect of the present disclosure also provides an electronic device.
Fig. 8 schematically illustrates a block diagram of an electronic device according to an embodiment of the disclosure. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 801 may also include on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the disclosure.
In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, ROM 802, and RAM 803 are communicatively connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 802 and/or the RAM 803. Note that the program may be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in one or more memories.
According to an embodiment of the present disclosure, the electronic device 800 may also include an input/output (I/O) interface 805, the input/output (I/O) interface 805 also being connected to the bus 804. The electronic device 800 may also include one or more of an input portion 806 including a keyboard, mouse, etc., an output portion 807 including a display such as a Cathode Ray Tube (CRT), liquid Crystal Display (LCD), etc., and speakers, etc., a storage portion 808 including a hard disk, etc., and a communication portion 809 including a network interface card such as a LAN card, modem, etc., connected to the I/O interface 805. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be included in the apparatus/device/system described in the above embodiments, or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 802 and/or RAM 803 and/or one or more memories other than ROM 802 and RAM 803 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program comprising program code for performing the methods provided by the embodiments of the present disclosure, the program code for causing an electronic device to implement the image model training method or the image processing method provided by the embodiments of the present disclosure when the computer program product is run on the electronic device.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 801. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed, and downloaded and installed in the form of a signal on a network medium, and/or from a removable medium 811 via a communication portion 809. The computer program may comprise program code that is transmitted using any appropriate network medium, including but not limited to wireless, wireline, etc., or any suitable combination of the preceding.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. These examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (11)

1.一种转换代码的方法,用于将第一程序支持的代码转换为第二程序支持的代码,其中,所述第一程序包括第一可扩展标记语言文件和Java文件,所述第一可扩展标记语言文件包括结构化查询语言代码,所述方法包括:1. A code conversion method for converting a code supported by a first program into a code supported by a second program, wherein the first program includes a first extensible markup language file and a Java file, and the first extensible markup language file includes a structured query language code, the method comprising: 获取所述第一可扩展标记语言文件和所述Java文件;以及Obtaining the first extensible markup language file and the Java file; and 通过可扩展标记语言解析方法重构所述结构化查询语言代码,并且通过模板生成方法重构所述Java文件中Java代码,得到所述第二程序的文件夹,所述第二程序的文件夹包括重构后的结构化查询语言代码和重构后的Java代码,The structured query language code is reconstructed by an extensible markup language parsing method, and the Java code in the Java file is reconstructed by a template generation method, to obtain a folder of the second program, wherein the folder of the second program includes the reconstructed structured query language code and the reconstructed Java code, 其中,所述第一可扩展标记语言文件包括业务语句和模板语句,所述业务语句和所述模板语句能够生成所述结构化查询语言代码;Wherein, the first extensible markup language file includes business statements and template statements, and the business statements and the template statements can generate the structured query language code; 所述通过可扩展标记语言解析方法重构所述结构化查询语言代码包括:The reconstructing the structured query language code by using the extensible markup language parsing method comprises: 使用可扩展标记语言文件解析器分别对所述业务语句和所述模板语句进行解析,得到解析结果;以及Using an extensible markup language file parser to parse the business statement and the template statement respectively to obtain parsing results; and 根据持久化格式要求生成针对所述解析结果的第二可扩展标记语言文件,并且在数据访问对象文件夹下生成与所述第二可扩展标记语言文件对应的Java文件。A second extensible markup language file is generated for the parsed result according to the persistence format requirement, and a Java file corresponding to the second extensible markup language file is generated in a data access object folder. 2.根据权利要求1所述的方法,其中,所述使用可扩展标记语言文件解析器分别对所述业务语句和所述模板语句进行解析,得到解析结果包括:2. The method according to claim 1, wherein the using an extensible markup language file parser to parse the business statement and the template statement respectively to obtain the parsing result comprises: 按文件遍历解析所述模板语句,所述模板语句是解析所述第一可扩展标记语言文件得到的语句;按文件遍历解析所述业务语句,所述模板语句和所述业务语句关联的存储在映射集合中;以及Parsing the template statement by file traversal, the template statement is a statement obtained by parsing the first extensible markup language file; parsing the business statement by file traversal, the template statement and the business statement are associated and stored in a mapping set; and 将所述业务语句和所述模板语句联合解析,得到重构的结构化查询语言代码。The business statement and the template statement are jointly parsed to obtain a reconstructed structured query language code. 3.根据权利要求2所述的方法,其中,所述根据持久化要求格式生成针对所述解析结果的第二可扩展标记语言文件包括:将所述重构的结构化查询语言代码存为满足持久化格式要求的第二可扩展标记语言文件。3. The method according to claim 2, wherein generating a second extensible markup language file for the parsed result according to the persistence requirement format comprises: storing the reconstructed structured query language code as a second extensible markup language file that meets the persistence format requirement. 4.根据权利要求3所述的方法,其中,所述在数据访问对象文件夹下生成与所述第二可扩展标记语言文件对应的Java文件包括:针对每个满足持久化格式要求的第二可扩展标记语言文件,在所述数据访问对象文件夹下生成与所述满足持久化格式要求的第二可扩展标记语言文件对应Java文件。4. The method according to claim 3, wherein generating a Java file corresponding to the second extensible markup language file under the data access object folder comprises: for each second extensible markup language file that meets the persistence format requirements, generating a Java file corresponding to the second extensible markup language file that meets the persistence format requirements under the data access object folder. 5.根据权利要求1至4任一项所述的方法,其中,所述通过模板生成方法重构所述Java文件中Java代码包括:5. The method according to any one of claims 1 to 4, wherein the reconstructing the Java code in the Java file by using a template generation method comprises: 解析Java代码以在服务文件夹中生成Java文件,并且在程序接口文件夹中生成与所述服务文件夹中的Java文件对应的Java文件。The Java code is parsed to generate a Java file in the service folder, and a Java file corresponding to the Java file in the service folder is generated in the program interface folder. 6.根据权利要求5所述的方法,其中,所述解析Java代码以在服务文件夹中生成Java文件包括:6. The method according to claim 5, wherein parsing the Java code to generate a Java file in the service folder comprises: 按文件遍历解析所述第一程序中的Java文件;Parsing the Java files in the first program by file traversal; 将所述第一程序中的Java文件中的结构化查询语言代码的调用方法,转换为数据访问对象文件夹下与所述结构化查询语言代码的调用方法对应的方法;以及Converting the calling method of the structured query language code in the Java file in the first program into a method corresponding to the calling method of the structured query language code in the data access object folder; and 基于与所述结构化查询语言代码的调用方法对应的方法生成所述服务文件夹中的Java文件。A Java file in the service folder is generated based on a method corresponding to the calling method of the structured query language code. 7.根据权利要求6所述的方法,其中,所述在程序接口文件夹中生成与所述服务文件夹中的Java文件对应的Java文件包括:7. The method according to claim 6, wherein generating a Java file corresponding to the Java file in the service folder in the program interface folder comprises: 在所述服务文件夹中生成至少一个Java文件之后,在所述程序接口文件中生成与所述服务文件夹中的Java文件对应的Java文件。After at least one Java file is generated in the service folder, a Java file corresponding to the Java file in the service folder is generated in the program interface file. 8.根据权利要求6所述的方法,还包括:在所述生成所述服务文件夹中的Java文件之后,响应于用户操作,对所述服务文件夹中的Java文件进行修改。8 . The method according to claim 6 , further comprising: after generating the Java file in the service folder, in response to a user operation, modifying the Java file in the service folder. 9.一种转换代码的装置,用于将第一程序支持的代码转换为第二程序支持的代码,其中,所述第一程序包括第一可扩展标记语言文件和Java文件,所述第一可扩展标记语言文件包括结构化查询语言代码,所述装置包括:9. A code conversion device, for converting a code supported by a first program into a code supported by a second program, wherein the first program includes a first extensible markup language file and a Java file, the first extensible markup language file includes a structured query language code, the device comprising: 文件获取模块,用于获取所述第一可扩展标记语言文件和所述Java文件;以及A file acquisition module, used to acquire the first extensible markup language file and the Java file; and 代码重构模块,用于通过可扩展标记语言解析方法重构所述结构化查询语言代码,并且通过模板生成方法重构所述Java文件中Java代码,得到所述第二程序的文件夹,所述第二程序的文件夹包括重构后的结构化查询语言代码和重构后的Java代码,a code refactoring module, configured to refactor the structured query language code by an extensible markup language parsing method, and to refactor the Java code in the Java file by a template generation method, to obtain a folder of the second program, wherein the folder of the second program includes the refactored structured query language code and the refactored Java code, 其中,所述第一可扩展标记语言文件包括业务语句和模板语句,所述业务语句和所述模板语句能够生成所述结构化查询语言代码;Wherein, the first extensible markup language file includes business statements and template statements, and the business statements and the template statements can generate the structured query language code; 所述通过可扩展标记语言解析方法重构所述结构化查询语言代码包括:The reconstructing the structured query language code by using the extensible markup language parsing method comprises: 使用可扩展标记语言文件解析器分别对所述业务语句和所述模板语句进行解析,得到解析结果;以及Using an extensible markup language file parser to parse the business statement and the template statement respectively to obtain parsing results; and 根据持久化格式要求生成针对所述解析结果的第二可扩展标记语言文件,并且在数据访问对象文件夹下生成与所述第二可扩展标记语言文件对应的Java文件。A second extensible markup language file is generated for the parsed result according to the persistence format requirement, and a Java file corresponding to the second extensible markup language file is generated in a data access object folder. 10.一种电子设备,包括:10. An electronic device comprising: 一个或多个处理器;one or more processors; 存储装置,用于存储可执行指令,所述可执行指令在被所述处理器执行时,实现根据权利要求1~8任一项所述的方法。A storage device for storing executable instructions, wherein when the executable instructions are executed by the processor, the method according to any one of claims 1 to 8 is implemented. 11.一种计算机可读存储介质,存储有计算机可执行指令,所述可执行指令在被处理器执行时,实现根据权利要求1~8任一项所述的方法。11. A computer-readable storage medium storing computer-executable instructions, wherein when the executable instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
CN202110900202.1A 2021-08-06 2021-08-06 Method, device and electronic device for converting code Active CN113568622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110900202.1A CN113568622B (en) 2021-08-06 2021-08-06 Method, device and electronic device for converting code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110900202.1A CN113568622B (en) 2021-08-06 2021-08-06 Method, device and electronic device for converting code

Publications (2)

Publication Number Publication Date
CN113568622A CN113568622A (en) 2021-10-29
CN113568622B true CN113568622B (en) 2025-04-15

Family

ID=78170623

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110900202.1A Active CN113568622B (en) 2021-08-06 2021-08-06 Method, device and electronic device for converting code

Country Status (1)

Country Link
CN (1) CN113568622B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117270838B (en) * 2023-11-22 2024-02-13 太平金融科技服务(上海)有限公司 Method, device, equipment and medium for generating universal formula script

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113138767A (en) * 2021-04-25 2021-07-20 中国工商银行股份有限公司 Code language conversion method, device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6925631B2 (en) * 2000-12-08 2005-08-02 Hewlett-Packard Development Company, L.P. Method, computer system and computer program product for processing extensible markup language streams
CN110737431B (en) * 2019-09-18 2023-07-14 深圳市金证科技股份有限公司 Software development method, development platform, terminal device and storage medium
CN111078230A (en) * 2019-12-06 2020-04-28 中国建设银行股份有限公司 Code generation method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113138767A (en) * 2021-04-25 2021-07-20 中国工商银行股份有限公司 Code language conversion method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113568622A (en) 2021-10-29

Similar Documents

Publication Publication Date Title
US9483260B1 (en) Documentation generation for web APIs based on byte code analysis
US9294543B2 (en) Generation of representational state transfer interface from application programming interfaces
US7506324B2 (en) Enhanced compiled representation of transformation formats
JP5204070B2 (en) Method for generating a tool for merging customizations made to a first version of a software product when migrating to a second version of the software product, a computer usable medium and a data processing system
US9424003B1 (en) Schema-less system output object parser and code generator
US9460224B2 (en) Selection mapping between fetched files and source files
US7366973B2 (en) Item, relation, attribute: the IRA object model
CN107391153B (en) Code generation method and device based on Spring and MyBatis framework integration
CN111950239B (en) Schema document generation method, device, computer equipment and medium
CN101271475A (en) A business intelligence system
CN110333863A (en) A kind of method and device for generating, showing the small routine page
CN101290624A (en) A method for automatic extraction of news webpage metadata
CN102566984A (en) Method and device for configuring parameters
Smith et al. Performance Model Interchange Format (PMIF 2): A comprehensive approach to queueing network model interoperability
CN113127442B (en) Method, device and storage medium for visualizing data model
CN113568622B (en) Method, device and electronic device for converting code
US20080114797A1 (en) Importing non-native content into a document
US20060230057A1 (en) Method and apparatus for mapping web services definition language files to application specific business objects in an integrated application environment
US12038940B2 (en) Architecture for data map converters
CN115640279A (en) Method and device for constructing data blood relationship
CN112860584A (en) Test method and device based on workflow model
US7716573B2 (en) Method and system for broadly sharing UML-based models
US20240036830A1 (en) Event consumption for high-level programing language platform
CN101288072A (en) Migration and transformation of data structures
Li et al. Automated creation of navigable REST services based on REST chart

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