Dynamic configuration analysis processing method and system based on user-defined XML (Extensible Markup Language) file

By building a configuration object model and a dynamic parsing engine, the problem of parsing logic fragmentation caused by the heterogeneity of configuration formats in existing XML parsing technologies is solved, standardized parsing and hot updates of custom XML files are achieved, and the efficiency and flexibility of enterprise-level configuration management are improved.

CN120704766APending Publication Date: 2025-09-26BEIJING JINHUI TECH CO LTD

Patent Information

Application Number
CN202511018023.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Existing XML parsing technology lacks standardized support for custom tags, cross-file references, and dynamic attributes, resulting in repeated development of adaptation logic for different business scenarios, low parsing code reuse rate, poor compatibility with existing frameworks when expanding custom functions, and easy occurrence of thread safety and performance bottlenecks.

Method used

By building a configuration object model that includes static properties, dynamic variable mapping tables, and external reference lists, combined with regular expressions and a built-in expression engine, standardized parsing of custom XML files is achieved. Recursive loading and caching strategies are adopted, and hot updates are achieved in conjunction with file system monitoring or configuration center subscriptions.

Benefits of technology

It realizes the standardized parsing of custom XML files, improves the efficiency and flexibility of configuration management, reduces system maintenance costs, improves the dynamic adaptability of configuration parameters, and ensures the legality and security of configuration files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704766A_ABST
    Figure CN120704766A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software configuration management, and discloses a dynamic configuration analysis processing method and system based on a user-defined XML file, and the method comprises the following steps: S1, receiving a service request, and obtaining service data containing dynamic parameters; s2, acquiring a corresponding configuration object model according to the configuration identifier; s3, traversing the dynamic variable mapping table; s4, if the configuration relates to the external reference, recursively loading the external configuration file and merging the external configuration file to the current configuration context; s5, selecting a cache or dynamic loading strategy according to the configuration type; s6, injecting the final configuration into the service logic module; and S7, dynamically refreshing the configuration through a monitoring mechanism. Standardized XML format specifications are constructed through customized DTD, analysis of cross-file reference labels and dynamic attribute identifiers is supported, unification and modularization of configuration formats are achieved from the bottom layer, the problem of analysis logic fragmentation is fundamentally solved, and the efficiency and flexibility of enterprise-level configuration management are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software configuration management, and in particular to a dynamic configuration parsing processing method and system based on a custom XML file. Background Art

[0002] In the field of enterprise-level software development, the widespread application of microservice architecture, distributed systems and business rule engines has put higher requirements on configuration management technology. Such systems need to dynamically define key logic such as business processes, routing strategies, parameter rules, etc. through structured configuration files to achieve flexible expansion and rapid iteration.

[0003] The core flaw of existing XML parsing technology is its insufficient support for custom business scenarios: DOM parsing: converts XML into an in-memory tree structure, which is suitable for static reading, but cannot dynamically load external resources or handle runtime parameter replacement, and memory usage increases sharply with file complexity; SAX parsing: has significant performance advantages when streaming large files, but can only parse basic syntax line by line and cannot recognize the business semantics of custom tags; common problems of existing solutions: none of them define a standardized tag system and extension rules, resulting in different projects or teams having to repeatedly develop adaptation logic, severe parsing code fragmentation, and difficulty supporting modular reuse of configurations.

[0004] The inventors of this application found that the existing technology relies on fixed formats because traditional XML parsing technology lacks standardized support for custom tags, cross-file references and dynamic attributes, resulting in the need to repeatedly develop adaptation logic for different business scenarios, low reuse rate of parsing code, and poor compatibility with existing frameworks when expanding custom functions. Manual processing of dynamic parameters can easily lead to problems such as thread safety and performance bottlenecks. The core technical problem can be summarized as the heterogeneity of configuration formats leading to fragmentation of parsing logic. Summary of the Invention

[0005] In order to make up for the above shortcomings, the present invention provides a dynamic configuration parsing processing method and system based on custom XML files, aiming to improve the problem of fragmentation of parsing logic caused by heterogeneity of configuration format of traditional XML parsing technology in the existing technology.

[0006] In a first aspect, the present invention provides the following technical solution, a dynamic configuration parsing method based on a custom XML file, comprising the following steps: S1. Receive a service request and obtain service data including dynamic parameters; S2. Obtain a corresponding configuration object model according to the configuration identifier, wherein the configuration object model is constructed by parsing a custom XML file, including static properties, a dynamic variable mapping table, and an external reference list; S3. Traverse the dynamic variable mapping table and perform dynamic attribute replacement based on business data; S4. If the configuration involves external references, recursively load the external configuration file and merge it into the current configuration context; S5. Select cache or dynamic loading strategy based on configuration type; S6. Inject the final configuration into the business logic module; S7. Dynamically refresh the configuration through the monitoring mechanism to achieve hot update.

[0007] By adopting the above technical solution: by building a configuration object model containing static properties, dynamic variable mapping tables and external reference lists, standardized parsing of custom XML files is achieved, regular expressions are combined to extract dynamic variables, and the built-in expression engine calculates complex logic. Configuration parameters are replaced in real time based on business data and external configurations are recursively loaded and merged. At the same time, local caching or dynamic pull strategies are intelligently selected according to the configuration type, and hot updates without restarting are achieved by cooperating with file system monitoring or configuration center subscriptions. This solves the problem of parsing logic fragmentation caused by heterogeneous configuration formats in existing technologies, eliminates hard-coded dependencies and improves the system's dynamic adaptability.

[0008] Preferably, the process of constructing the configuration object model in S2 further includes: Perform DTD or XSD syntax verification on XML files, including <include>The max-depth attribute of the tag is checked to limit the recursion depth to no more than 5 layers. If not explicitly specified, the default value is 3 layers.

[0009] Preferably, the dynamic attribute replacement in S3 includes: According to the hierarchical structure of business data, the specific value of the dynamic variable is located through the node path. If the business data does not contain the variable value, the default value is used.

[0010] Preferably, when recursively loading the external configuration file in S4, the step further includes: Perform topological sorting and circular dependency detection on dependency relationships. If a circular reference is found, an exception message containing the error line number and reference path is thrown. The topological sorting algorithm uses the Kahn algorithm or the DFS algorithm to implement topological sorting, and detects circular dependencies through the following steps: Kahn algorithm: Count the in-degree of each vertex and gradually remove vertices with in-degree 0. If the number of remaining vertices is not 0, there is a circular dependency. DFS algorithm: Mark the vertex status during the traversal process. If a vertex that has been visited but not completed is found, it is determined to be a circular dependency.

[0011] Preferably, the execution strategy selection in S5 further includes: For configurations with real-time requirements higher than the preset threshold, the dynamic loading strategy is forcibly triggered, ignoring the local cache; For non-critical businesses that allow a certain degree of delay, cache is used first to reduce IO overhead.

[0012] Preferably, the configuration change monitoring in S7 includes: The file system monitoring module uses polling or event callback to monitor the configuration file directory, and the configuration center subscription module receives configuration change notifications in real time through a persistent connection. Either trigger starts the incremental parsing process and only updates the configuration nodes that have changed.

[0013] In a second aspect, the present invention provides the following technical solution, a dynamic configuration parsing processing system based on a custom XML file, comprising: Request receiving module: used to obtain business requests and business data; Configuration loading module: used to obtain the configuration object model, recursively load external configuration files and select execution strategy; Dynamic replacement module: used to perform dynamic attribute replacement and expression calculation, including regular matching engine and expression parser; Policy execution module: used to generate executable configuration instances and inject them into business logic modules; Hot update module: used to monitor configuration changes and dynamically refresh, including file monitoring threads and configuration center client components.

[0014] Preferably, it also includes: Verification and error handling module: used to verify the syntax validity of XML files, locate tag nesting errors and attribute missing problems, return detailed information including error line number, node path and error type, and throw exceptions when circular dependencies are detected.

[0015] In the third aspect, the invention provides the following technical solution: a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned dynamic configuration parsing method based on a custom XML file when executing the computer program.

[0016] In a fourth aspect, the present invention provides the following technical solution: a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-mentioned dynamic configuration parsing processing method based on a custom XML file.

[0017] The present invention has the following beneficial effects: 1. The present invention proposes to construct a standardized XML format specification through a custom DTD, supports the parsing of cross-file reference tags and dynamic attribute identifiers, realizes the unification and modularization of the configuration format from the bottom layer, fundamentally solves the problem of fragmentation of parsing logic, and improves the efficiency and flexibility of enterprise-level configuration management.

[0018] 2. A dynamic adaptation mechanism is proposed to replace configuration parameters in real time based on business data. By defining standardized dynamic attribute identifiers, a built-in expression engine supports complex logical calculations, and establishes automatic mapping rules between business data and configuration parameters, the configuration parameters can be dynamically changed with business data.

[0019] 3. DTD pre-defines tag structure and attribute rules to ensure that configuration files comply with business format specifications. At the same time, a pluggable logic verification plug-in is introduced to detect business logic errors in real time during the parsing phase. When an error occurs, the system accurately returns detailed information including the error line number, node path, and error type, allowing developers to quickly locate the problem without debugging line by line, shortening the configuration error troubleshooting time by more than 70%, significantly reducing system maintenance costs, and improving development efficiency and stability in complex configuration scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a flow chart of the dynamic configuration parsing and processing system based on custom XML files proposed by the present invention; DETAILED DESCRIPTION The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0021] Example 1: Reference Figure 1 In a first embodiment of the present invention, the present invention provides a dynamic configuration parsing processing method based on a custom XML file, comprising the following steps: S1. Receive a service request and obtain service data including dynamic parameters; S2. Obtain the corresponding configuration object model according to the configuration identifier. The configuration object model is constructed by parsing a custom XML file, including static properties, a dynamic variable mapping table, and an external reference list; S3. Traverse the dynamic variable mapping table and perform dynamic attribute replacement based on business data; S4. If the configuration involves external references, recursively load the external configuration file and merge it into the current configuration context; S5. Select cache or dynamic loading strategy based on configuration type; S6. Inject the final configuration into the business logic module; S7. Dynamically refresh the configuration through the monitoring mechanism to achieve hot update.

[0022] Specifically, the dynamic configuration parsing processing method based on custom XML files realizes dynamic configuration management in complex business scenarios through standardized XML format definition, dynamic parsing engine and hot update mechanism.

[0023] S1. Receive business requests and obtain business data containing dynamic parameters. The system receives business requests through API interfaces or message queues, parses structured data in the request body, such as JSON and form data, extracts business data containing dynamic parameters, supports request access from multiple protocols such as HTTP and RPC, parses request parameters through interceptors or filters, and performs hierarchical structured processing on business data, such as converting it into a Map object or JavaBean to facilitate subsequent dynamic variable positioning. If the business request is to create an order, the business data may include "orderId" as "20250417001", "userId" as "1001", and "region" as "CN", where "userId" and "region" are dynamic parameters and participate in configuration replacement.

[0024] S2. Build a configuration object model. Based on the configuration identifier in the request, obtain the configuration object model from the local cache or through a dynamic loading mechanism. The model is generated by parsing a custom XML file and consists of three core parts: XML syntax validation: Before parsing, verify the validity of XML through DTD or XSD files, including tag nesting rules, such as " <config>"Must include" <staticparams>"and" <dynamicvars>"Child node; attribute type verification, such as" <include>The "max-depth" attribute of the "tag" must be a positive integer.

[0025] If the verification fails, a detailed exception including the error line number and node path is thrown, such as "Line 25 <include>The tag is missing the required attribute 'path'".

[0026] Model construction details: Static attributes: Directly read fixed parameter values ​​in XML, such as " <staticparams> <timeout> 3000< / timeout> < / staticparams> " resolves to "timeout=3000".

[0027] Dynamic variable mapping table: Use the regular expression "${(\w+)}" to extract dynamic variables in XML attribute values, such as "url=http: / / api.${region}.com", and record the variable name "region", the node path " / config / route / url", and the default value, such as "default=CN".

[0028] External reference list: parsing"<includepath=payment-config.XMLmax-depth=3 / > " tag, record the external file path and recursion depth limit, and build the dependency tree.

[0029] S3: Dynamic attribute replacement, traverses the dynamic variable mapping table, and replaces dynamic identifiers in XML based on business data. It supports two types: Basic variable replacement (${variable}): Gets the value from the business data according to the hierarchical path based on the variable name. For example, "region" corresponds to the "region" field in the business data. If the business data does not contain the variable, the default value is used. For example, "endpoint=${service.region}" in XML and "region=US" in business data are replaced with "endpoint=US".

[0030] Expression calculation (#{expression}): Dynamically calculates expression results through built-in expression engines such as MVEL and EL expressions, supporting mathematical operations, logical judgments, and function calls. For example, in XML, "discount=#{price>1000?price*0.9:price}" is replaced with "discount=1350" after calculation based on the business data "price=1500".

[0031] S4: Recursively load external configuration files. If the configuration contains " <include>" tag, follow the steps below to handle dependencies: Dependency resolution: recursively load external files and merge nodes into the current configuration context, such as " <route>" nodes are added to the execution chain of the current configuration. A topological sorting algorithm is used to detect circular dependencies. If a cycle is found, an exception is thrown and the error path is marked. For example, "The 12th line of file A.XML references B.XML, and the 8th line of B.XML reversely references A.XML, forming a circular dependency." Node merging strategy: For node attributes with the same name, the child configuration overrides the parent configuration. The child node contents are merged, such as " <staticparams>The repeat parameter in " is based on the last loaded file.

[0032] S5: Execution strategy selection, dynamically select the loading strategy based on the configuration type, local or external, and real-time requirements: For local high-frequency configuration, such as basic routing rules, local caches, such as GuavaCache or Ehcache, are preferred. The cache key is "configId + version number" to reduce I / O overhead. Cache expiration policies support timed expiration, such as refresh every 10 minutes, or passive expiration based on configuration changes.

[0033] External real-time configuration, such as third-party interface addresses: Dynamically pull the latest configuration through configuration centers such as Nacos, Apollo, or the file system, support HTTP long polling or WebSocket real-time notifications, and for real-time requirements higher than the threshold, such as 100ms configuration, ignore the cache and directly pull the latest version to ensure that the business uses real-time data.

[0034] S6: Configuration injection and business triggering, converting the final parsed configuration, including static properties, replaced dynamic values, and merged external nodes, into an executable instance, such as a Map, POJO, or configuration object, and injecting it into the business logic module: Injection method: Supports dependency injection frameworks such as Spring's "@Value" or custom configuration annotations, or passes parameters to business components to inject the payment routing configuration into the payment module, triggering the interface call logic: "PaymentService.invoke(config.getEndpoint(),config.getTimeout())".

[0035] S7: Dynamic refresh and hot update: A dual-dimensional monitoring mechanism enables real-time configuration updates without restarting the service: Monitoring method: File system monitoring: Use JavaNIO's WatchService or polling mechanism to monitor the configuration directory, detect changes in file modification timestamps, trigger incremental parsing, and re-parse only the changed files and their dependencies.

[0036] Configuration center subscription: Receive real-time notifications of configuration center changes through persistent connections, such as Apollo's HTTP long polling, to obtain the changed configuration node path and new value.

[0037] Incremental update: When parsing a change file, only the changed parts in the dynamic variable mapping table and external reference list are updated to avoid the performance loss of full parsing. After the update, the business module is notified through the event bus to reload the configuration instance, achieving a one-second update effect.

[0038] The construction process of the configuration object model in S2 also includes: Perform DTD or XSD syntax verification on XML files, including <include>The max-depth attribute of the tag is checked to limit the recursion depth to no more than 5 layers. If not explicitly specified, the default value is 3 layers.

[0039] Specifically, in the process of building the configuration object model, the DTD (Document Type Definition) or XSD (XML Schema Definition) syntax verification mechanism is introduced, combined with the <include>The recursive depth limit of the max-depth attribute of the tag is a core technical means to ensure the legality, security and parsing reliability of the configuration file.

[0040] By using the tag nesting rules defined by DTD / XSD (such as the root tag <config>Must include <staticparams>and <dynamicvars>child nodes), attribute type constraints (such as <include>The path attribute of the tag is a required string, and the max-depth attribute is a positive integer. Ensure that the custom XML file conforms to the preset format specifications. If there are missing tags, incorrect attribute value formats (such as max-depth="abc"), or nested levels that violate the standard, the verification process will block parsing and trigger an exception to avoid confusion in the parsing logic caused by non-standard formats.

[0041] against <include>The max-depth attribute of the tag is checked to limit the recursive reference depth of external configuration files (for example, the preset maximum value is 5 layers). This effectively prevents problems such as parsing stack overflow and performance loss caused by circular references or deep nesting between configuration files. When file A references file B, and file B references file A, the parsing process may fall into infinite recursion if the depth is not limited. With the max-depth check, the system can terminate the recursion and report an error when the preset depth is reached, ensuring the controllability of the parsing process.

[0042] Dynamic attribute replacement in S3 includes: According to the hierarchical structure of business data, the specific value of the dynamic variable is located through the node path. If the business data does not contain the variable value, the default value is used.

[0043] Specifically, in real-world business scenarios, the content and structure of business data are complex and ever-changing. By locating node paths based on the hierarchical structure of business data, the system can extract the required dynamic variable values ​​from the business data, allowing configuration files to be dynamically adjusted based on different business requests and adapt to diverse business scenarios.

[0044] When recursively loading external configuration files in S4, it also includes: Perform topological sorting and circular dependency detection on dependency relationships. If a circular reference is found, an exception message containing the error line number and reference path is thrown. Topological sorting algorithm: Use Kahn algorithm or DFS algorithm to implement topological sorting, and detect circular dependencies through the following steps: Kahn algorithm: Count the in-degree of each vertex and gradually remove vertices with in-degree 0. If the number of remaining vertices is not 0, there is a circular dependency. DFS algorithm: Mark the vertex status during the traversal process. If a vertex that has been visited but not completed is found, it is determined to be a circular dependency.

[0045] Specifically, topological sorting is an algorithm for sorting directed acyclic graphs (DAGs). When processing dependencies between external configuration files, it can arrange each configuration file in the order of dependency. This ensures that when recursively loading external configuration files, each configuration file is loaded only after all its dependent files have been loaded. For example, if configuration file A depends on configuration files B and C, topological sorting will ensure that B and C are loaded before A, thus avoiding configuration errors caused by improper loading order.

[0046] A circular dependency refers to a closed loop of mutual references between two or more configuration files, such as configuration file A referencing configuration file B, which in turn references configuration file A. Without circular dependency detection, the system can fall into an infinite recursion during recursive loading, ultimately leading to a stack overflow or system crash. Circular dependency detection allows the system to promptly detect and address these anomalies, ensuring system stability and reliability.

[0047] Execution strategy selection in S5 also includes: For configurations with real-time requirements higher than the preset threshold, the dynamic loading strategy is forcibly triggered, ignoring the local cache; For non-critical businesses that allow a certain degree of delay, cache is used first to reduce IO overhead.

[0048] Specifically, different business scenarios have significantly different requirements for real-time configuration. For configurations with real-time requirements exceeding preset thresholds, such as exchange rate configurations in financial trading systems and rules for limited-time promotions on e-commerce platforms, timely and accurate configuration must be ensured. Forcing a dynamic loading strategy to ignore the local cache ensures that the system obtains the latest configuration information, enabling accurate business decisions and avoiding business errors or losses caused by using outdated configurations.

[0049] For non-critical businesses that tolerate a certain degree of latency, such as internal report generation and data statistical analysis, the real-time requirements for the configuration are relatively low. Prioritizing cache to reduce I / O overhead can improve system performance and efficiency while ensuring normal business operations.

[0050] Configuration change monitoring in S7 includes: The file system monitoring module uses polling or event callback to monitor the configuration file directory, and the configuration center subscription module receives configuration change notifications in real time through a persistent connection. Either trigger starts the incremental parsing process and only updates the configuration nodes that have changed.

[0051] Specifically, the file system listener module monitors the configuration file directory through polling or event callbacks, promptly capturing modifications to local configuration files. The configuration center subscription module, on the other hand, utilizes persistent connections to receive configuration change notifications in real time, enabling rapid response to configuration updates stored in the configuration center in a distributed environment. These two approaches, combined, ensure that the system is immediately aware of modifications to both local files and changes to the configuration center, enabling real-time configuration updates and ensuring that business logic always uses the latest configuration information.

[0052] Example 2: Reference Figure 1 In a second embodiment of the present invention, the present invention provides a dynamic configuration parsing processing system based on a custom XML file, comprising: Request receiving module: used to obtain business requests and business data; Configuration loading module: used to obtain the configuration object model, recursively load external configuration files and select execution strategy; Dynamic replacement module: used to perform dynamic attribute replacement and expression calculation, including regular matching engine and expression parser; Policy execution module: used to generate executable configuration instances and inject them into business logic modules; Hot update module: used to monitor configuration changes and dynamically refresh, including file monitoring threads and configuration center client components.

[0053] Specifically, the request receiving module: The request receiving module is the primary link between the system and external businesses. It supports multiple communication protocols such as HTTP, gRPC, WebSocket, and Kafka, and can convert business data in different formats into a unified internal object. It uses a recursive parsing algorithm to process nested data, integrates a parameter validation framework to ensure input legality, and extracts configuration identifiers from requests to accurately match configuration files. Its role is to convert complex business data into standardized input, providing a reliable data source for subsequent processes and reducing development and adaptation costs.

[0054] The configuration loading module first verifies the file's validity using the DTD / XSD, extracts static attributes, dynamic variables, and external reference information to construct a configuration object model. It then uses depth-first search to recursively load external files and uses topological sorting to detect circular dependencies. Furthermore, it caches frequently used configurations, while highly real-time configurations are pulled from the configuration center. This module implements reliable conversion from XML files to configuration object models, laying the foundation for dynamic adaptation.

[0055] Dynamic Replacement Module: This module replaces dynamic identifiers in the configuration in real time based on business data, supporting both basic variable replacement and complex expression calculations. It efficiently completes replacement operations through precompiled regular expressions and thread-safe traversal, and also supports expression caching. It generates customized configurations based on real-time business data, enabling a single configuration template to adapt to multiple scenarios, enhancing the system's flexibility and adaptability.

[0056] Policy Execution Module: This module converts parsed and replaced configurations into executable instances for business modules. It can generate POJO objects, configuration dictionaries, environment variables, and other formats, along with version information. It integrates with various frameworks, enables configuration injection through annotations or explicit parameter passing, and adds monitoring and traceability mechanisms. This module decouples configuration from business logic, implementing "configuration as code" and improving system maintainability and stability.

[0057] Hot update module: The hot update module captures configuration changes in real time through file system monitoring and configuration center subscription, adopts incremental update and double buffering mechanism to ensure update consistency, and notifies business modules to reload configuration through the event bus. Configuration can take effect in seconds without stopping the service, solving the pain point of configuration updates relying on service restart in traditional solutions, and meeting the high-frequency, low-latency configuration update requirements under the microservice architecture.

[0058] Also includes: Verification and error handling module: used to verify the syntax validity of XML files, locate tag nesting errors and attribute missing problems, return detailed information including error line number, node path and error type, and throw exceptions when circular dependencies are detected.

[0059] Specifically, the validation and error handling module verifies the syntax of XML files, locating tag nesting errors and missing attributes. It returns detailed information including the error line number, node path, and error type, and throws an exception if a circular dependency is detected. This module ensures that configuration files conform to specifications, avoids system errors caused by syntax issues, and improves system robustness.

[0060] Example 3 The third embodiment of the present invention is based on the same inventive concept. The present invention proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the dynamic configuration parsing processing method based on a custom XML file of the above embodiment.

[0061] Example 4 The fourth embodiment of the present invention is based on the same inventive concept. The present invention proposes a terminal, which includes: a processor and a memory; the processor and the memory communicate with each other; the memory is used to store instructions; the processor is used to execute the instructions in the memory, and execute the dynamic configuration parsing processing method based on the custom XML file of the above embodiment.

[0062] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.

[0063] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.< / include> < / include> < / dynamicvars> < / staticparams> < / config> < / include> < / include> < / staticparams> < / route> < / include> < / include> < / include> < / dynamicvars> < / staticparams> < / config> < / include>

Claims

1. A dynamic configuration parsing method based on a custom XML file, characterized in that: The following steps are involved: S1. Receive a service request and obtain service data including dynamic parameters; S2. Obtain a corresponding configuration object model according to the configuration identifier, wherein the configuration object model is constructed by parsing a custom XML file, including static properties, a dynamic variable mapping table, and an external reference list; S3. Traverse the dynamic variable mapping table and perform dynamic attribute replacement based on business data; S4. If the configuration involves external references, recursively load the external configuration file and merge it into the current configuration context; S5. Select cache or dynamic loading strategy based on configuration type; S6. Inject the final configuration into the business logic module; S7. Dynamically refresh the configuration through the monitoring mechanism to achieve hot update.

2. The dynamic configuration parsing method based on a custom XML file according to claim 1, characterized in that: The construction process of the configuration object model in S2 also includes: Perform DTD or XSD syntax verification on XML files, including <include> The max-depth attribute of the tag is checked to limit the recursion depth to no more than 5 layers. If not explicitly specified, the default value is 3 layers.< / include> 3. The dynamic configuration parsing method based on a custom XML file according to claim 1, characterized in that: The dynamic attribute replacement in S3 includes: According to the hierarchical structure of business data, the specific value of the dynamic variable is located through the node path. If the business data does not contain the variable value, the default value is used.

4. The dynamic configuration parsing method based on a custom XML file according to claim 1, characterized in that: When recursively loading external configuration files in S4, the following is also included: Perform topological sorting and circular dependency detection on dependency relationships. If a circular reference is found, an exception message containing the error line number and reference path is thrown. The topological sorting algorithm uses the Kahn algorithm or the DFS algorithm to implement topological sorting, and detects circular dependencies through the following steps: Kahn algorithm: Count the in-degree of each vertex and gradually remove vertices with in-degree 0. If the number of remaining vertices is not 0, there is a circular dependency. DFS algorithm: Mark the vertex status during the traversal process. If a vertex that has been visited but not completed is found, it is determined to be a circular dependency.

5. The dynamic configuration parsing method based on a custom XML file according to claim 1, characterized in that: The execution strategy selection in S5 further includes: For configurations with real-time requirements higher than the preset threshold, the dynamic loading strategy is forcibly triggered, ignoring the local cache; For non-critical businesses that allow a certain degree of delay, cache is used first to reduce IO overhead.

6. The dynamic configuration parsing method based on a custom XML file according to claim 1, characterized in that: The configuration change monitoring in S7 includes: The file system monitoring module uses polling or event callback to monitor the configuration file directory, and the configuration center subscription module receives configuration change notifications in real time through a persistent connection. Either trigger starts the incremental parsing process and only updates the configuration nodes that have changed.

7. A dynamic configuration parsing and processing system based on a custom XML file, characterized in that: A method for implementing a dynamic configuration parsing process based on a custom XML file according to any one of claims 1 to 6, comprising: Request receiving module: used to obtain business requests and business data; Configuration loading module: used to obtain the configuration object model, recursively load external configuration files and select execution strategy; Dynamic replacement module: used to perform dynamic attribute replacement and expression calculation, including regular matching engine and expression parser; Policy execution module: used to generate executable configuration instances and inject them into business logic modules; Hot update module: used to monitor configuration changes and dynamically refresh, including file monitoring threads and configuration center client components.

8. The dynamic configuration parsing and processing system based on a custom XML file according to claim 7, characterized in that: Also includes: Verification and error handling module: used to verify the syntax validity of XML files, locate tag nesting errors and attribute missing problems, return detailed information including error line number, node path and error type, and throw exceptions when circular dependencies are detected.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the dynamic configuration parsing processing method based on the custom XML file is implemented as described in any one of claims 1 to 6.

10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the dynamic configuration parsing processing method based on a custom XML file according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • XML (extensible markup language) message processing method and XML message processing device

    CN102622444A

  • Extensive makeup language (XML) script resolver based on analysis server (AS) and method for script resolver

    CN102880492A

  • Data exchange file format design method and device based on XML template configuration

    CN113886645A

  • Parallel approach to XML parsing

    US20090089658A1

Cited By

  • Method and device for adjusting and calculating liquid rocket engine based on XML (Extensible Markup Language) analysis and storage

    CN121560833A

  • IDE-based tree node information remark implementation method and device

    CN121807374A