Analysis method and system for XML format digital electronic ticket, and storage medium
By building an invoice parsing program script, batch analysis and automatic data export of XML format count tickets are realized, which solves the problems of low manual reading efficiency and high error rate, and achieves fast and accurate invoice data processing and risk control.
Patent Information
- Application Number
- CN202311514710.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-05-16
AI Technical Summary
In the prior art, the main reliance on manual reading of XML format invoices, which have problems of inefficiency and high error rate.
It provides a method for parsing electric tickets for XML format. By constructing an invoice parsing program script, it can batch parse the XML format digital tickets and automatically export data to Excel, achieving rapid and accurate completion of invoice data extraction, classification and statistics.
It achieves the rapid and accurate completion of invoice data extraction, classification and statistics, assists in invoice risk control, and reduces the workload and error rate of manual processing.
Smart Images

Figure CN120012719A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic invoices, and in particular to a parsing method, system and storage medium for XML-formatted electronic invoices. Background Art
[0002] With the deepening of the digital transformation of taxation, the pilot scope of fully digitalized electronic invoices (abbreviated as digital invoices) has been continuously expanded, which has brought great challenges to the invoice management of enterprises. On the one hand, digital invoices in XML format are very important. According to regulations, after receiving digital invoices, enterprises must save the digital invoices in XML format containing digital signatures, regardless of whether they are printed and archived. On the other hand, the layout of the digital invoice format files (PDF, OFD) is relatively simple, and its invoice layout does not fully display the invoice information. Only the invoice in XML format contains complete information. However, the invoice in XML format is a string of code in form. Although it records all the data of the invoice, the invoice in XML format is not suitable for data reading and statistics. At present, it mainly relies on manual reading of records, which is inefficient and has a high error rate. Summary of the invention
[0003] The main purpose of the present invention is to solve the problem that the existing technology mainly relies on manual reading of XML format invoices, which is inefficient and has a high error rate. To achieve the above purpose, the present invention provides a parsing method, system and storage medium for XML format digital invoices, which can batch parse XML format digital invoices and automatically export data to Excel, quickly and accurately complete invoice data extraction, classification and statistics, and help invoice risk management.
[0004] An embodiment of the present invention provides a method for parsing an XML-formatted electronic invoice, comprising:
[0005] Constructing an invoice parsing program script, and packaging the constructed invoice parsing program script into an executable file and saving it in an electronic device;
[0006] Construct an invoice pool folder and store the electronic invoices to be parsed in the invoice pool folder;
[0007] Run the execution file to batch parse all digital invoices in the invoice pool folder.
[0008] As a specific implementation of the present invention, an invoice parsing program script is constructed, including:
[0009] Parse the digital invoice and construct a DOM document about the digital invoice;
[0010] Obtain the value of each identification element of the DOM document, and store the obtained value of each identification element in the corresponding transfer variable, the identification element includes the document root element and the specific tag element;
[0011] Construct multiple variable parameters, where the multiple variable parameters correspond to each identification element one by one;
[0012] Assign the element values stored in each transfer variable to the corresponding variable parameters respectively;
[0013] Construct an empty list, fill it with multiple variable parameters after assignment, and save it as an Excel file in the set path.
[0014] As a specific embodiment of the present invention, constructing an invoice parsing program script also includes:
[0015] Build the execution window, path variables, and a function to get the directory path selected by the user;
[0016] The execution window pops up a file dialog box to allow the user to select a file directory;
[0017] The get function obtains the path of the file directory selected by the user and assigns the value of the obtained path to the path variable.
[0018] As a specific embodiment of the present invention, constructing an invoice parsing program script also includes:
[0019] Define a check function to check whether the value of the path variable exists;
[0020] If the value of the path variable exists, the files under the path corresponding to the value of the path variable are parsed.
[0021] As a specific implementation of the present invention, building the invoice parsing program script is performed in a Python environment.
[0022] As a specific implementation of the present invention, an invoice parsing program script is constructed by importing Tkinter, os, requests, base64, pandas and xml.dom.minidom external data function library into Python.
[0023] As a specific embodiment of the present invention, the parsing method for XML format electronic invoices also includes:
[0024] After batch parsing all the digital invoices in the invoice pool folder, log in to the VAT invoice comprehensive service platform, batch check and verify the parsed invoices, and filter out the target digital invoices that need to be authenticated, match them with the downloaded invoice files, and upload the matched invoice files to the VAT invoice comprehensive service platform for batch authentication.
[0025] Accordingly, an embodiment of the present invention further provides a parsing system for XML-formatted electronic invoices, which is used in electronic devices. The system includes:
[0026] A script construction module is used to construct an invoice parsing program script, and encapsulate the constructed invoice parsing program script into an executable file and save it in the electronic device;
[0027] A folder construction module is used to construct an invoice pool folder and store each digital invoice to be parsed in the invoice pool folder;
[0028] The run module is used to run the execution file to batch parse all digital invoices in the invoice pool folder.
[0029] As a specific implementation of the present invention, the script construction module includes:
[0030] The parsing unit is used to parse the digital invoice and construct a DOM document about the digital invoice;
[0031] An acquisition unit, used to acquire the value of each identification element of the DOM document, and store the acquired value of each identification element in a corresponding transfer variable, the identification element includes a document root element and a specific tag element;
[0032] A parameter construction unit, used to construct a plurality of variable parameters, wherein the plurality of variable parameters correspond one to one with each identification element;
[0033] The assignment unit is used to assign the element values stored in each transfer variable to the corresponding variable parameters;
[0034] The list construction unit is used to construct an empty list, fill the empty list based on multiple variable parameters after assignment, and save it as an Excel file stored in the set path.
[0035] Correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed on a computer, the computer executes the method in any of the above specific implementations.
[0036] Compared with the prior art, the present invention has at least the following technical effects:
[0037] The parsing method for XML-formatted digital invoices provided by the present invention can realize batch parsing of XML-formatted digital invoices and automatically export data to Excel by constructing an invoice parsing program script, thereby realizing rapid and accurate completion of data extraction, classification and statistics, and multi-dimensional management and control of invoice authenticity, compliance, and risks of duplicate entries. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flowchart of a method for parsing XML-formatted electronic invoices provided by an embodiment of the present invention is shown;
[0039] Figure 2 A flowchart of constructing an invoice parsing program script provided by an embodiment of the present invention is shown;
[0040] Figure 3 A specific flow chart of parsing digital invoices based on DOM technology in a Python environment provided by an embodiment of the present invention is shown;
[0041] Figure 4 A structural block diagram of a parsing system for XML-formatted electronic invoices provided by an embodiment of the present invention is shown;
[0042] Figure 5 A structural block diagram of a system on chip (SOC) provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0043] The following specific embodiments illustrate the implementation of the present invention, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation. On the contrary, the purpose of introducing the invention in conjunction with the implementation is to cover other options or modifications that may be extended based on the claims of the present invention. In order to provide a deep understanding of the present invention, the following description will include many specific details. The present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0044] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0045] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0046] As the scope of the digital invoice pilot continues to expand, enterprises receive more and more digital invoices. Especially for most enterprises that have not launched an online full-process automated invoice management system, it is difficult to control the authenticity, duplicate entries and compliance of digital invoices. For enterprises that have not launched an online full-process automated invoice management system, the specific digital invoice control measures are as follows: 1. Regarding the authenticity of invoices, take the approach of logging in to the VAT invoice comprehensive service platform to check to prevent risks. 2. Regarding the problem of duplicate entries, register the digital invoice ledger to check whether it is a duplicate entry to prevent risks. 3. Regarding compliance issues, the main method of preventing risks is to check whether the relevant information of the invoice is consistent with the contract agreement. The above measures can play a certain role in preventing risks, but there are also the following problems:
[0047] 1. The workload of manual processing is huge. First, the workload of manually verifying each digital invoice is huge. Even if the verification method is adopted, the verification code needs to be entered one by one. Second, the workload of manually registering each invoice is huge. The registration ledger not only needs to register the invoice number, but also needs to register the invoice date, seller name, project name, specification model, unit, quantity and other contents. A large amount of data needs to be entered manually. Third, the workload of manually checking and verifying each item is huge. The invoice information of the digital invoice layout file is incomplete. The layout file of the digital invoice does not show the name and account number of the seller's bank account. Manual verification requires checking each item. Therefore, more manpower is required to complete this work.
[0048] 2. The error rate of manual entry of each item in the ledger is extremely high. The invoice number of the electronic invoice consists of 20 Arabic numerals. Manual entry is prone to errors and difficult to detect, which affects the prevention effect of the risk of duplicate entries.
[0049] Therefore, in order to solve the above-mentioned problems of huge manual processing workload and high error rate of manual account registration, a specific embodiment of the present invention provides a method for parsing electronic bills in XML format. Specifically, Figure 1 As shown, the method comprises the following steps:
[0050] Step S101: construct an invoice parsing program script, and encapsulate the constructed invoice parsing program script into an executable file and save it in the electronic device.
[0051] Specifically, refer to Figure 2 As shown, building an invoice parser script includes the following steps:
[0052] Step S1011: parse the digital invoice and construct a DOM document about the digital invoice.
[0053] Exemplarily, building the invoice parsing program script is performed in a Python environment, and the invoice parsing program script can be built by importing external data function libraries such as Tkinter, os, requests, base64, pandas, and xml.dom.minidom in Python, and using the common functions in the external data function libraries.
[0054] Step S1012: Acquire the value of each identification element of the DOM document, and store the acquired value of each identification element in a corresponding transfer variable. The identification elements include the document root element and a specific tag element.
[0055] First, define a function get_info(file, filename), which is used to obtain and print specific information from an XML file. For example, at the beginning of the function, the function xml.dom.minidom.parse(file) of the xml.dom.minidom database can be called to parse the XML file object as a parameter and return a DOM document object, thereby logically establishing a tree model for the XML document. The root element of the DOM document and elements with specific tag names are obtained through dom.documentElement. These tag names can include 'Remark', 'EIid', 'SellerName', 'SellerBankName', 'SellerBankAccNum', 'TotalAmWithoutTax', 'TotalTaxAm', 'TotalTax-includedAmount', 'RequestTime', etc. The specific tag names can be set according to the specific needs of the digital invoice.
[0056] Taking the tag parameter with the tag name 'Remark' as an example, use dom.getElementsByTagName('Remark') to find all Remark elements in the document and store the result in the cc variable. This element is the remark content in the 'Remark' tag in the digital invoice. Check the number of elements in the cc variable. If the number of elements is greater than 0, it means that there is at least one Remark element. Get the first Remark element through cc[0], and get the data of the first child node of the element through cl.firstChild.data, and use remark.replace("\n","") to replace the line break with a space; if the number of elements in the cc variable is not greater than 0, it means that there is no Remark element. Then the next element EIid will be found in the document. Specifically, dom.getElementsByTagName('EIid')[0] gets the first element named "EIid", then .firstChild gets the first child node of the element, and then .data gets the data of the child node (a text node) and stores it in the variable tongyi. Similarly, find the set tag name and extract specific information, and store the extracted information in a variable for subsequent use.
[0057] Step S1013: construct multiple variable parameters, where the multiple variable parameters correspond one-to-one to each identification element.
[0058] Step S1014: assign the element values stored in each transfer variable to the corresponding variable parameters respectively.
[0059] Specifically, getElementsByTagName is used to get the first element named "EInvoiceData" from the DOM and store it in the variable a. Then, all elements with the tag name "IssuItemInformation" are obtained and stored in the variable all, and then each element in all is iterated over using a for loop. A new empty dictionary al is then created, and the code checks whether the current element b is equal to the first element in all (i.e., all[0]). If element b is the first element in all, al["EIid"] = tongyi is to assign the value of the variable tongyi to the item with the key "EIid" in the dictionary al, and so on. The keys and corresponding values assigned to the dictionary include: "SellerName" is assigned to the variable mingcheng, "SellerBankName" is assigned to the variable bank, "SellerBankAccNum" is assigned to the variable user, "TotalAmWithoutTax" is assigned to the variable totalt, "TotalTaxAm" is assigned to the variable totala, "TotalTax-includedAmount" is assigned to the variable totali, "RequestTime" is assigned to the variable rtime, and so on.
[0060] Next, we extract the value of the child element from element b by using the getElementsByTagName method and get the text content of the child element using .firstChild.data. If element b is not the first element in all, we perform the same operation but without any specific assignment to the dictionary. We add the dictionary al to the list alist_all using the append() method.
[0061] Step S1015: construct an empty list, fill the empty list based on the multiple variable parameters after assignment, and save it as an Excel file stored in the set path.
[0062] That is, define an empty list info_list to store the extracted metadata. Define a function named return_res that takes a parameter img, representing the file path to be processed. Inside the function, first obtain all the file names under the img path. Traverse these file names. If the file name contains ".xml", call the get_info function to extract the metadata contained in the XML file and store this metadata in a list (info_list). Then, convert this list to a pandas DataFrame and save it as an Excel file. Obtain the current working directory and append "\Invoice after Digital Resolution Data.xlsx" to it as the path to save the Excel file.
[0063] Exemplarily, step S101 further includes:
[0064] Step S1016: Construct an execution window, a path variable, and a retrieval function for obtaining the directory path selected by the user; the execution window pops up a file dialog box to allow the user to select a file directory; the retrieval function obtains the path of the file directory selected by the user and assigns the value of the obtained path to the path variable.
[0065] Specifically, use the tkinter database to build an interactive interface, create a new Tk window, and set the title of the window to "Digital Invoice Batch Parsing Tool".
[0066] max_w, max_h = root.maxsize() to get the maximum width and height of the screen, use root.geometry(f'500x300+{int((max_w-500) / 2)}+{int((max_h-300) / 2)}') to set the window size to 500x300 and center it in the middle of the screen, and use root.resizable(width=False, height=False) to prevent users from changing the size of the window. Create a label (Labels), the label is label=tkinter.Label(root, text='Select file:', font=('Arial',15)), the text is "Select file:", the font is Arial, the size is 15, and it is placed at (50,100) on the screen. entry_text=tkinter.StringVar() creates a StringVar object, which is used to store and reflect the value of a variable. Create a read-only input box, entry = tkinter.Entry(root, textvariable = entry_text, font = ('FangSong', 10), width = 30, state = 'readonly'), whose text is controlled by the entry_text variable, the font is FangSong, the size is 10, the width is 30, and it is placed at (150, 105) on the screen.
[0067] Create a path variable named path_ with path_ = "":, then define a function defget_path(): to get the directory path selected by the user, and use filedialog.askdirectory() to open a file dialog box to allow the user to select a directory. The selected directory path will be assigned to the path variable path_, and the content of the input box will be updated through entry_text.set(path_).
[0068] Step S1017: define a check function to check whether the value of the path variable exists; if the value of the path variable exists, parse the files under the path corresponding to the value of the path variable.
[0069] Specifically, a function defstart(): can be defined, which is called when the "Start" button is clicked. This function first checks whether a directory has been selected (that is, checks whether the global variable path_ exists). If a directory has been selected, return_res(path_) is called to perform file recognition. After the recognition is completed, a dialog box pops up to ask the user whether to open the recognition result. If the user chooses to open, os.system is used to open the recognition result file. If the directory has not been selected, an information box will pop up to prompt the user to select a file first.
[0070] In addition, you can also create a button button = tkinter.Button (root, text = 'Select path', command = get_path):, the text is "Select path", when the button is clicked, the get_path function will be called. Create another button button = tkinter.Button (root, text = 'Start', width = 20, height = 2, command = start), the text is "Start", the width is 20, the height is 2, when the button is clicked, the start function will be called. Place these buttons in specific locations on the interface. root.mainloop (): Start the Tkinter event loop.
[0071] Step S1018: Save the above script as a ".py" file, use Pyinstaller to package the ".py" file into an ".exe" executable file and store it in the electronic device.
[0072] Step S102: construct an invoice pool folder, and store the digital invoices to be parsed in the invoice pool folder.
[0073] Specifically, in actual operation, an employee initiates a reimbursement application, that is, the employee provides an XML-formatted electronic invoice and a copy of the layout file to the accountant, and the accountant saves the received XML-formatted electronic invoice into the invoice pool folder.
[0074] Step S103: Run the execution file to batch parse all digital invoices in the invoice pool folder.
[0075] Specifically, the accountant runs the .EXE file, and the program interface pops up on the computer desktop. Click the "Select Path" button to pop up the folder selection dialog box. Select the invoice pool folder and click the "Select Folder" button to return to the program interface. Click the "Start" button to start parsing the invoice. After the parsing is completed, a prompt dialog box pops up, asking "Do you want to open the recognition result?" Select the "Yes" button to open the Excel file. The table extracts and summarizes the information of the invoices in the invoice pool. The Excel file is saved in the same path as the .EXE file.
[0076] Furthermore, after batch parsing all digital invoices in the invoice pool folder, you can also log in to the VAT invoice comprehensive service platform, batch check and verify the parsed invoices, and filter out the target digital invoices that need to be authenticated, match them with the downloaded invoice files, and upload the matched invoice files to the VAT invoice comprehensive service platform for batch authentication.
[0077] Specifically, Figure 3 The specific flow chart of the method for analyzing digital electronic bills provided in a specific embodiment of the present application is shown, including the following steps:
[0078] (1) Create a computer application. Use the functions of the xml.dom.minidom, tkinter, filedialog, messagebox, os, requests, base64, and pandas modules in the Python environment to develop an invoice parsing program script. Encapsulate the developed script into an .EXE file, which is an executable program. Save the .EXE file on the accountant's computer. Create an invoice pool folder on the accountant's computer to store the received digital invoices.
[0079] (2) An employee initiates a reimbursement application. The employee provides the XML-formatted electronic invoice and a copy of the format file to the accountant, who then saves the XML-formatted electronic invoice to the invoice pool.
[0080] (3) Batch parsing of invoices. The accountant runs the .EXE file, and the program interface pops up on the computer desktop. Click the "Select Path" button to pop up the folder selection dialog box. Select the invoice pool folder and click the "Select Folder" button to return to the program interface. Click the "Start" button to start parsing the invoices. After the parsing is completed, a prompt dialog box pops up asking "Do you want to open the recognition results?" Select the "Yes" button to open the Excel file. The table extracts and summarizes the information of the invoices in the invoice pool. The Excel file is saved in the same path as the .EXE file.
[0081] (4) Invoice batch verification. Log in to the VAT invoice integrated service platform and select invoice batch verification. Use the digital invoice summary information obtained in step (3) to copy it to the invoice batch verification template and upload it for verification.
[0082] (5) Check for duplicate invoices. Using the Excel file of the digital invoice summary information obtained in step (3), set an Excel duplicate value red reminder to indicate duplicate invoices.
[0083] (6) Invoice authentication. Log in to the VAT invoice integrated service platform and select the invoice batch deduction check box. Use the digital invoice summary information obtained in step (3) to filter out the digital invoices that need to be authenticated that month, match them with the downloaded invoice files, and upload the matching invoice files for batch authentication.
[0084] (7) Reimbursement. After the accountant verifies the electronic invoice, he / she shall attach a copy of the electronic invoice format file as an attachment to the reimbursement and use it together with other original vouchers as a reimbursement voucher.
[0085] (8) Filing. The reimbursement voucher and the XML version of the electronic invoice shall be submitted to the archive administrator for filing.
[0086] Accordingly, the present invention also provides a parsing system for XML format digital invoices, referring to Figure 4 As shown, the system includes: a script construction module 1, a folder construction module 2 and a running module 3.
[0087] Specifically, the script construction module 1 is used to construct an invoice parsing program script, and encapsulate the constructed invoice parsing program script into an execution file and save it in an electronic device; the folder construction module 2 is used to construct an invoice pool folder, and store the digital invoices to be parsed in the invoice pool folder; the running module 3 is used to run the execution file to batch parse all digital invoices in the invoice pool folder.
[0088] Exemplarily, the script construction module 1 includes a parsing unit 11 , an acquiring unit 12 , a parameter construction unit 13 , an assignment unit 14 and a list construction unit 15 .
[0089] Among them, the parsing unit 11 is used to parse the digital invoice and construct a DOM document about the digital invoice; the acquisition unit 12 is used to obtain the numerical value of each identification element of the DOM document, and store the obtained numerical value of each identification element in the corresponding transit variable, the identification element includes the document root element and the specific tag element; the parameter construction unit 13 is used to construct multiple variable parameters, and the multiple variable parameters correspond to each identification element one by one; the assignment unit 14 is used to assign the element values stored in each transit variable to the corresponding variable parameters respectively; the list construction unit 15 is used to construct an empty list, fill the empty list based on the multiple variable parameters after assignment, and save it as an Excel file stored in the set path.
[0090] The functions of the modules or units in this system are the same as those in the control method and will not be elaborated here.
[0091] The present invention constructs a system and implementation method for parsing digital invoices based on DOM tree in Python environment, which can parse digital invoices in XML format in batches and automatically export data to Excel, quickly and accurately complete invoice data extraction, classification and statistics, and help invoice risk management. And this method has been applied in the Guiyan Financial Management Department, realizing the rapid and accurate completion of digital invoice data extraction, classification and statistics, and can control the authenticity, compliance and duplicate entry of invoices in multiple dimensions.
[0092] refer to Figure 5 , which is a block diagram of a system on chip (SoC) 500 according to an embodiment of the present application. Figure 5 In the FIG, similar components have the same reference numerals. In addition, the dashed boxes are optional features of more advanced SoCs. Figure 5 In the embodiment, SoC 500 includes: an interconnect unit 550 coupled to a processor 510; a system agent unit 580; a bus controller unit 590; an integrated memory controller unit 540; a group or one or more coprocessors 520, which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random access memory (SRAM) unit 530; and a direct memory access (DMA) unit 560. In one embodiment, the coprocessor 520 includes a special-purpose processor, such as, for example, a network or communication processor, a compression engine, a general-purpose computing on graph processing units (GPGPU), a high-throughput M-chip processor, or an embedded processor.
[0093] Static random access memory (SRAM) unit 530 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, and more specifically, stores temporary and permanent copies of the instructions. The instructions may include: when executed by at least one of the processors, causing the SoC to implement the following: Figure 1 or Figure 2 When the instructions are executed on a computer, the computer is caused to execute the method disclosed in the above embodiments.
[0094] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0095] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0096] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0097] Although the present invention has been illustrated and described with reference to the embodiments of the present invention, it should be understood by those skilled in the art that the above contents are further detailed descriptions of the present invention in combination with specific embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art may make various changes in form and details, including making several simple deductions or substitutions without departing from the spirit and scope of the present invention.
Claims
1. A method for parsing XML-formatted electronic invoices, characterized in that: include: Constructing an invoice parsing program script, and packaging the constructed invoice parsing program script into an executable file and saving it in an electronic device; Construct an invoice pool folder, and store the digital invoices to be parsed in the invoice pool folder; Run the execution file to batch parse all digital invoices in the invoice pool folder.
2. The method according to claim 1, characterized in that Build the invoice parser script, including: Parsing the digital ticket and constructing a DOM document about the digital ticket; Obtaining the value of each identification element of the DOM document, and storing the obtained value of each identification element in a corresponding transfer variable, wherein the identification element includes a document root element and a specific tag element; Constructing a plurality of variable parameters, wherein the plurality of variable parameters correspond one-to-one to each of the identification elements; Assigning the element values stored in each of the transfer variables to the corresponding variable parameters respectively; Construct an empty list, fill the empty list based on the multiple variable parameters after assignment, and save it as an Excel file stored in the set path.
3. The method according to claim 2, characterized in that Build the invoice parser script, also including: Build the execution window, path variables, and a function to get the directory path selected by the user; The execution window pops up a file dialog box to allow the user to select a file directory; The acquisition function acquires the path of the file directory selected by the user, and assigns the value of the acquired path to the path variable.
4. The method according to claim 3, characterized in that Build the invoice parser script, also including: Define a check function to check whether the value of the path variable exists; If the value of the path variable exists, the files under the path corresponding to the value of the path variable are parsed.
5. The method according to any one of claims 1 to 4, characterized in that: Building the invoice parser script is done in the Python environment.
6. The method according to claim 5, characterized in that The invoice parser script is constructed by importing Tkinter, os, requests, base64, pandas and the xml.dom.minidom external data function library in Python.
7. The method according to claim 1, characterized in that Also includes: After batch parsing all the digital invoices in the invoice pool folder, log in to the VAT invoice comprehensive service platform, batch check and verify the parsed invoices, and screen out the target digital invoices that need to be authenticated, match them with the downloaded invoice files, and upload the matched invoice files to the logged-in VAT invoice comprehensive service platform for batch authentication.
8. A parsing system for XML-formatted electronic invoices, used in electronic devices, characterized in that: include A script construction module, used to construct an invoice parsing program script, and encapsulate the constructed invoice parsing program script into an executable file and save it in the electronic device; A folder construction module is used to construct an invoice pool folder and store each digital invoice to be parsed in the invoice pool folder; The running module is used to run the execution file to batch parse all the digital invoices in the invoice pool folder.
9. The system according to claim 8, characterized in that The script building blocks include: A parsing unit, used for parsing the digital electronic ticket and constructing a DOM document about the digital electronic ticket; An acquisition unit, used to acquire the value of each identification element of the DOM document, and store the acquired value of each identification element in a corresponding transfer variable, wherein the identification element includes a document root element and a specific tag element; A parameter construction unit, used to construct a plurality of variable parameters, wherein the plurality of variable parameters correspond one-to-one to each of the identification elements; An assignment unit, used to assign the element values stored in each of the transfer variables to the corresponding variable parameters; The list construction unit is used to construct an empty list, fill the empty list based on the multiple variable parameters after assignment, and save it as an Excel file stored in a set path.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the speaker temperature control method according to any one of claims 1 to 7.