Layout file conversion method, device, electronic device and computer readable medium
By automatically converting the sub-tag names, namespace names, attribute names and attribute values in the layout file, a layout file adapted to the second type of system is generated, which solves the problem of low conversion efficiency of layout files between different types of systems and improves efficiency. Develop efficiencies and save resources.
Patent Information
- Application Number
- CN202110627633.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-04
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-06-04
Smart Images

Figure CN113157276B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a layout file conversion method, device, electronic device, and computer-readable medium. Background Art
[0002] The layout file is a file used to define the page view so that the page view can be rendered when the page is loaded. At present, after developing the page view in one type of system, when developing the page view in another type of system, the usual method is to rewrite the layout file in the other type of system.
[0003] However, when the above method is adopted, the following technical problems often occur: the layout file under another type of system needs to be rewritten according to the previously written layout file, resulting in low page view development efficiency and waste of development resources. Summary of the invention
[0004] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0005] Some embodiments of the present disclosure propose a layout file conversion method, device, electronic device, and computer-readable medium to solve one of the technical problems mentioned in the above background technology section.
[0006] In a first aspect, some embodiments of the present disclosure provide a layout file conversion method, the method comprising: for each first layout file in a first layout file set in a first target file directory, performing the following conversion steps: based on each sub-tag name, namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the above-mentioned first layout file, converting the above-mentioned first layout file to obtain the converted first layout file as a second layout file, wherein the above-mentioned first layout file is used for page view rendering under a first type of system, and the above-mentioned second layout file is used for page view rendering under a second type of system; adding the above-mentioned second layout file to the second target file directory.
[0007] Optionally, before executing the following conversion step, the method further includes: sending preset prompt information to an associated display device, wherein the preset prompt information is used to prompt the user to add the first layout file set to the first target file directory.
[0008] Optionally, before executing the following conversion steps, the method further includes: receiving second layout file directory configuration information; in response to the existence of a file directory corresponding to the second layout file directory configuration information, determining the file directory as a second target file directory.
[0009] Optionally, before executing the following conversion step, the method further includes: in response to the absence of a file directory corresponding to the second layout file directory configuration information, creating the file directory as a second target file directory.
[0010] Optionally, before converting the first layout file, the conversion step further includes: matching the first layout file to obtain each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier.
[0011] Optionally, the above-mentioned conversion processing of the above-mentioned first layout file includes: for each sub-tag name among the above-mentioned sub-tag names, based on a preset sub-tag name conversion information set, wherein the preset sub-tag name conversion information in the above-mentioned preset sub-tag name conversion information set includes a pre-conversion sub-tag name and a post-conversion sub-tag name, performing the following steps: in response to the presence of preset sub-tag name conversion information corresponding to the sub-tag name before conversion included in the above-mentioned preset sub-tag name conversion information set, determining the above-mentioned preset sub-tag name conversion information as the target preset sub-tag name conversion information; replacing the above-mentioned sub-tag name with the post-conversion sub-tag name included in the above-mentioned target preset sub-tag name conversion information.
[0012] Optionally, the above-mentioned conversion processing of the above-mentioned first layout file includes: for each namespace name among the above-mentioned namespace names, based on a preset namespace name conversion information set, wherein the preset namespace name conversion information in the above-mentioned preset namespace name conversion information set includes a namespace name before conversion and a namespace name after conversion, performing the following steps: in response to the presence of preset namespace name conversion information corresponding to the namespace name before conversion included in the above-mentioned preset namespace name conversion information set, determining the above-mentioned preset namespace name conversion information as the target preset namespace name conversion information; replacing the above-mentioned namespace name with the namespace name after conversion included in the above-mentioned target preset namespace name conversion information.
[0013] Optionally, the above-mentioned conversion processing of the above-mentioned first layout file includes: for each attribute name in the above-mentioned attribute names and attribute values, based on a preset attribute name conversion information set, wherein the preset attribute name conversion information in the above-mentioned preset attribute name conversion information set includes a pre-conversion attribute name and a post-conversion attribute name, performing the following steps: in response to the presence of preset attribute name conversion information including a pre-conversion attribute name corresponding to the above-mentioned attribute name in the above-mentioned preset attribute name conversion information set, determining the above-mentioned preset attribute name conversion information as target preset attribute name conversion information; replacing the above-mentioned attribute name with a post-conversion attribute name included in the above-mentioned target preset attribute name conversion information; for each attribute value in the above-mentioned attribute names and attribute values, based on a preset attribute value conversion information set, wherein the preset attribute value conversion information in the above-mentioned preset attribute value conversion information set includes a pre-conversion attribute value and a post-conversion attribute value, performing the following steps: in response to the presence of preset attribute value conversion information including a pre-conversion attribute value corresponding to the above-mentioned attribute value in the above-mentioned preset attribute value conversion information set, determining the above-mentioned preset attribute value conversion information as target preset attribute value conversion information; replacing the above-mentioned attribute value with a post-conversion attribute value included in the above-mentioned target preset attribute value conversion information.
[0014] Optionally, the above-mentioned conversion processing of the above-mentioned first layout file includes: for each of the above-mentioned target identifiers, based on a preset identifier conversion information set, wherein the preset identifier conversion information in the above-mentioned preset identifier conversion information set includes a pre-conversion identifier and a post-conversion identifier, performing the following steps: in response to the presence of preset identifier conversion information corresponding to the pre-conversion identifier included in the above-mentioned preset identifier conversion information set and the above-mentioned target identifier, determining the above-mentioned preset identifier conversion information as the target preset identifier conversion information; replacing the above-mentioned target identifier with the post-conversion identifier included in the above-mentioned target preset identifier conversion information.
[0015] In a second aspect, some embodiments of the present disclosure provide a layout file conversion device, the device comprising: an execution unit, configured to perform the following conversion steps for each first layout file in a first layout file set in a first target file directory: a conversion unit, configured to convert the first layout file based on each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag, and each target identifier in the first layout file, to obtain the converted first layout file as a second layout file, wherein the first layout file is used for page view rendering under a first type of system, and the second layout file is used for page view rendering under a second type of system; an adding unit, configured to add the second layout file to the second target file directory.
[0016] Optionally, before the execution unit, the apparatus further includes: a sending unit configured to send preset prompt information to an associated display device, wherein the preset prompt information is used to prompt the user to add the first layout file set to the first target file directory.
[0017] Optionally, before the execution unit, the device further includes: a receiving unit and a determining unit. The receiving unit is configured to receive the second layout file directory configuration information; the determining unit is configured to determine the file directory as the second target file directory in response to the existence of the file directory corresponding to the second layout file directory configuration information.
[0018] Optionally, before the execution unit, the apparatus further includes: a creation unit configured to, in response to the absence of a file directory corresponding to the second layout file directory configuration information, create the file directory as the second target file directory.
[0019] Optionally, before the conversion unit, the conversion step further includes: performing matching processing on the first layout file to obtain each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag and each target identifier.
[0020] Optionally, the conversion unit includes: a first conversion sub-unit, configured to perform the following steps for each sub-tag name among the above-mentioned sub-tag names based on a preset sub-tag name conversion information set, wherein the preset sub-tag name conversion information in the above-mentioned preset sub-tag name conversion information set includes a pre-conversion sub-tag name and a post-conversion sub-tag name: in response to the presence of preset sub-tag name conversion information corresponding to the above-mentioned sub-tag name including the pre-conversion sub-tag name in the above-mentioned preset sub-tag name conversion information set, determine the above-mentioned preset sub-tag name conversion information as the target preset sub-tag name conversion information; and replace the above-mentioned sub-tag name with the post-conversion sub-tag name included in the above-mentioned target preset sub-tag name conversion information.
[0021] Optionally, the conversion unit includes: a second conversion sub-unit, configured to perform the following steps for each namespace name in the above-mentioned namespace names based on a preset namespace name conversion information set, wherein the preset namespace name conversion information in the above-mentioned preset namespace name conversion information set includes a namespace name before conversion and a namespace name after conversion: in response to the presence of preset namespace name conversion information corresponding to the above-mentioned namespace name including a namespace name before conversion in the above-mentioned preset namespace name conversion information set, determining the above-mentioned preset namespace name conversion information as the target preset namespace name conversion information; replacing the above-mentioned namespace name with the namespace name after conversion included in the above-mentioned target preset namespace name conversion information.
[0022] Optionally, the conversion unit includes: a third conversion subunit and a fourth conversion subunit. The third conversion subunit is configured to perform the following steps for each attribute name in the above-mentioned attribute names and attribute values based on a preset attribute name conversion information set, wherein the preset attribute name conversion information in the above-mentioned preset attribute name conversion information set includes a pre-conversion attribute name and a post-conversion attribute name: in response to the presence of preset attribute name conversion information including a pre-conversion attribute name corresponding to the above-mentioned attribute name in the above-mentioned preset attribute name conversion information set, determine the above-mentioned preset attribute name conversion information as the target preset attribute name conversion information; and replace the above-mentioned attribute name with the post-conversion attribute name included in the above-mentioned target preset attribute name conversion information. The fourth conversion sub-unit is configured to perform the following steps for each attribute value in the above-mentioned attribute names and attribute values based on a preset attribute value conversion information set, wherein the preset attribute value conversion information in the above-mentioned preset attribute value conversion information set includes a pre-conversion attribute value and a post-conversion attribute value: in response to the presence of preset attribute value conversion information including a pre-conversion attribute value corresponding to the above-mentioned attribute value in the above-mentioned preset attribute value conversion information set, determine the above-mentioned preset attribute value conversion information as the target preset attribute value conversion information; and replace the above-mentioned attribute value with the post-conversion attribute value included in the above-mentioned target preset attribute value conversion information.
[0023] Optionally, the conversion unit includes: a fifth conversion subunit, configured to perform the following steps for each target identifier among the above-mentioned target identifiers based on a preset identifier conversion information set, wherein the preset identifier conversion information in the above-mentioned preset identifier conversion information set includes a pre-conversion identifier and a post-conversion identifier: in response to the presence of preset identifier conversion information corresponding to the pre-conversion identifier included in the above-mentioned preset identifier conversion information set and the above-mentioned target identifier, determine the above-mentioned preset identifier conversion information as the target preset identifier conversion information; and replace the above-mentioned target identifier with the post-conversion identifier included in the above-mentioned target preset identifier conversion information.
[0024] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0025] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0026] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: through the layout file conversion method of some embodiments of the present disclosure, the page view development efficiency is improved and development resources are saved. Specifically, the reason for the low efficiency of page view development and the waste of development resources is that the layout file under another type of system needs to be rewritten according to the previously written layout file, resulting in low efficiency of page view development and waste of development resources. Based on this, the layout file conversion method of some embodiments of the present disclosure performs the following conversion steps for each first layout file in the first layout file set in the first target file directory: First, based on each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the above-mentioned first layout file, the above-mentioned first layout file is converted and processed to obtain the converted first layout file as the second layout file. Among them, the above-mentioned first layout file is used for page view rendering under the first type system, and the above-mentioned second layout file is used for page view rendering under the second type system. Thus, each sub-tag name, namespace name, each attribute name and attribute value of the sub-tag and the target identifier in the first layout file can be automatically converted to automatically generate a second layout file adapted to the second type system. Then, the second layout file is added to the second target file directory. Thus, the second layout file obtained after automatic conversion can be added to the corresponding file directory for the second type system to render the page view. Also, because the first layout file can be automatically converted to the second layout file, when developing the page view under the second type system, there is no need to rewrite the layout file. This improves the development efficiency of the page view and saves development resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0028] Figure 1-2 is a schematic diagram of an application scenario of a layout file conversion method according to some embodiments of the present disclosure;
[0029] Figure 3 is a flow chart of some embodiments of the layout file conversion method according to the present disclosure;
[0030] Figure 4 are flow charts of other embodiments of the layout file conversion method according to the present disclosure;
[0031] Figure 5 is a schematic diagram of the structure of some embodiments of the layout file conversion device according to the present disclosure;
[0032] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0033] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0034] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0035] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0036] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0037] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0038] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0039] Figure 1-2 It is a schematic diagram of an application scenario of the layout file conversion method according to some embodiments of the present disclosure.
[0040] exist Figure 1In the application scenario, first, for each first layout file (e.g., first layout file 1021) in the first layout file set 102 in the first target file directory, the computing device 101 may perform the following conversion steps: First, based on each subtag name 10211, each namespace name 10212, each attribute name and attribute value 10213 of each subtag, and each target identifier 10214 in the first layout file 1021, the first layout file 1021 is converted to obtain the converted first layout file as the second layout file 103. The first layout file 1021 is used for page view rendering under the first type of system. The second layout file 103 is used for page view rendering under the second type of system. Then, the second layout file 103 is added to the second target file directory.
[0041] Alternatively, if Figure 2 As shown, first, the computing device 101 may receive the second layout file directory configuration information 104. Then, in response to the existence of the file directory 105 corresponding to the second layout file directory configuration information 104, the computing device 101 may determine the file directory 105 as the second target file directory.
[0042] It should be noted that the computing device 101 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made here.
[0043] It should be understood that Figure 1-2 The number of computing devices in the embodiment is only illustrative. Any number of computing devices may be provided according to implementation requirements.
[0044] Continue to refer Figure 3 , shows a process 300 of some embodiments of the layout file conversion method according to the present disclosure. The layout file conversion method comprises the following steps:
[0045] Step 301: for each first layout file in the first layout file set in the first target file directory, perform the following conversion steps:
[0046] Step 3011, based on each subtag name, each namespace name, each attribute name and attribute value of each subtag and each target identifier in the first layout file, the first layout file is converted to obtain the converted first layout file as the second layout file.
[0047] In some embodiments, the execution body of the layout file conversion method (for example Figure 1 The computing device 101 shown in the figure can convert the first layout file based on the sub-tag names, namespace names, attribute names and attribute values of the sub-tags, and target identifiers in the first layout file to obtain the converted first layout file as the second layout file. Among them, the first target file directory can be a file directory for storing the first layout file set. The first layout file can be a layout file under the first type system. The first layout file is used for page view rendering under the first type system. The first type system can be a system adapted by the previously written layout file. For example, the first type system can be an "Android system". The first layout file can be an XML file under the "Android system". The second layout file is used for page view rendering under the second type system. The second type system can be a system adapted by the converted layout file. For example, when the first type system is an "Android system", the second type system can be a "HarmonyOS system". The second layout file can be an XML file under the "HarmonyOS system". It is understandable that when the above-mentioned first type system is the "HarmonyOS system", the above-mentioned first layout file may be an XML file under the "HarmonyOS system", the above-mentioned second type system may be the "Android system", and the above-mentioned second layout file may be an XML file under the "Android system". The above-mentioned sub-tag name may be a name used to identify a sub-node in the first layout file, and the above-mentioned sub-tag name may belong to a start tag. The above-mentioned sub-tag name may also belong to a closing tag. It is understandable that the above-mentioned sub-nodes may refer to nodes of various levels under the root node of the first layout file. For example, when the first layout file is an XML file under the "Android system", the above-mentioned sub-tag name may be "TextView". The above-mentioned sub-tag name "TextView" may belong to a start tag <textview> The above sub-tag name "TextView" can also belong to the closing tag< / textview> The sub-tag name can also be "EditText". The sub-tag name "EditText" can belong to the start tag <edittext> The above sub-tag name "EditText" can also belong to the closing tag< / edittext>. The above-mentioned namespace name may be the name of the namespace to which each subtag name belongs. For example, the name of the namespace to which the subtag names "TextView" and "EditText" belong may be "android". The above-mentioned attribute name may be the name of the additional information added to the start tag. For example, the above-mentioned attribute name may be "layout_width". The above-mentioned attribute name may also be "layout_height". The above-mentioned attribute value may be the value of the additional information added to the start tag. For example, when the first layout file is an XML file under the "Android system", the above-mentioned attribute value may be "fitCenter". The above-mentioned attribute value may also be "fitStart". The above-mentioned target identifier may be other characters or strings to be replaced. The above-mentioned target identifier may include: a uniform resource identifier, a system resource reference character. The above-mentioned system resource reference character may be a target character in a system resource reference string. For example, when the first layout file is an XML file under the "Android system", the above-mentioned system resource reference string may be "@dimen / lib_search_dimen_70". The above-mentioned target characters may include "@" and " / ".
[0048] In practice, the execution subject can parse the first layout file to obtain the subtag names, namespace names, attribute names and attribute values of the subtags, and target identifiers. For each of the subtag names, the execution subject can replace the subtag name in the first layout file with the converted subtag name corresponding to the subtag name in the preset subtag name conversion table in response to determining that the subtag name exists in the preset subtag name conversion table. The preset subtag name conversion table can be a preset table including subtag names under the first type system and converted subtag names under the second type system.
[0049] For each of the namespace names, the execution subject may, in response to determining that the namespace name exists in the preset namespace name conversion table, replace the namespace name in the first layout file with a converted namespace name corresponding to the namespace name in the preset namespace name conversion table. The preset namespace name conversion table may be a preset table including namespace names under the first type of system and converted namespace names under the second type of system.
[0050] For each of the attribute names, the execution subject may, in response to determining that the attribute name exists in the preset attribute name conversion table, replace the attribute name in the first layout file with a converted attribute name corresponding to the attribute name in the preset attribute name conversion table. The preset attribute name conversion table may be a preset table including attribute names under the first type system and converted attribute names under the second type system.
[0051] For each of the attribute values, the execution subject may, in response to determining that the attribute value exists in the preset attribute value conversion table, replace the attribute value in the first layout file with a conversion attribute value corresponding to the attribute value in the preset attribute value conversion table. The preset attribute value conversion table may be a preset table including attribute values under the first type system and conversion attribute values under the second type system.
[0052] For each target identifier in each target identifier, the execution subject may, in response to determining that the target identifier exists in the preset target identifier conversion table, replace the target identifier in the first layout file with a conversion target identifier corresponding to the target identifier in the preset target identifier conversion table. The preset target identifier conversion table may be a preset table including target identifiers under the first type system and conversion target identifiers under the second type system.
[0053] It can be understood that the second layout file may be a layout file obtained by converting the first layout file, or may be a layout file saved after converting the first layout file.
[0054] As an example, the above execution subject can replace the subtag name "TextView" in the first layout file with the converted subtag name "Text" through the following preset subtag name conversion table. It can be understood that the subtag names and converted subtag names in the preset subtag name conversion table are not limited to the examples in the following preset subtag name conversion table.
[0055] Preset subtag name conversion table
[0056]
[0057] The above execution subject can replace the namespace name "android" in the first layout file with the conversion namespace name "ohos" through the following preset namespace name conversion table. It can be understood that the namespace names and conversion namespace names in the preset namespace name conversion table are not limited to the examples in the following preset namespace name conversion table.
[0058] Default namespace name conversion table
[0059]
[0060] The above execution subject can convert the attribute name "layout_width" in the first layout file into the attribute name "width" through the following preset attribute name conversion table. It can be understood that the attribute names and converted attribute names in the preset attribute name conversion table are not limited to the examples in the following preset attribute name conversion table.
[0061] Preset attribute name conversion table
[0062]
[0063] The above execution subject can convert the attribute value "fitCenter" in the first layout file into the attribute value "scale_to_fit_center" through the following preset attribute value conversion table. It can be understood that the attribute values and conversion attribute values in the preset attribute value conversion table are not limited to the examples in the following preset attribute value conversion table.
[0064] Preset attribute value conversion table
[0065]
[0066] The execution subject can convert the target identifier "@" in the first layout file into the target identifier "$" through the following preset target identifier conversion table. It is understandable that the target identifiers and conversion target identifiers in the preset target identifier conversion table are not limited to the examples in the following preset target identifier conversion table.
[0067] Preset target identifier conversion table
[0068]
[0069] In some optional implementations of some embodiments, the execution subject may perform matching processing on the first layout file to obtain each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier. In practice, the execution subject may match each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier by using a regular expression method. Thus, each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier in the first layout file may be obtained by matching.
[0070] In some optional implementations of some embodiments, for each of the above sub-tag names, based on a preset sub-tag name conversion information set, wherein the preset sub-tag name conversion information in the preset sub-tag name conversion information set includes a sub-tag name before conversion and a sub-tag name after conversion, the execution subject may perform the following steps:
[0071] The first step is to determine the preset subtag name conversion information as the target preset subtag name conversion information in response to the presence of preset subtag name conversion information corresponding to the subtag name before conversion and the above-mentioned subtag name in the above-mentioned preset subtag name conversion information set. Among them, the above-mentioned preset subtag name conversion information can be information for converting the subtag name in the first layout file into a subtag name under the second type of system. The correspondence between the above-mentioned subtag name before conversion and the above-mentioned subtag name can be: the above-mentioned subtag name before conversion is the same as the above-mentioned subtag name. Therefore, under the condition that the current subtag name needs to be converted, the preset subtag name conversion information for converting the current subtag name in the preset subtag name conversion information set can be determined.
[0072] The second step is to replace the sub-tag name with the converted sub-tag name included in the target preset sub-tag name conversion information. In practice, the execution entity may first delete the sub-tag name in the first layout file. Then, the converted sub-tag name may be added to the position corresponding to the sub-tag name in the first layout file. Thus, the current sub-tag name may be converted by the determined preset sub-tag name conversion information.
[0073] In some optional implementations of some embodiments, for each of the above-mentioned namespace names, based on a preset namespace name conversion information set, wherein the preset namespace name conversion information in the preset namespace name conversion information set includes a namespace name before conversion and a namespace name after conversion, the execution subject may perform the following steps:
[0074] The first step is to determine the preset namespace name conversion information as the target preset namespace name conversion information in response to the presence of preset namespace name conversion information corresponding to the namespace name before conversion and the above-mentioned namespace name in the above-mentioned preset namespace name conversion information set. Among them, the above-mentioned preset namespace name conversion information can be information for converting the namespace name in the first layout file into a namespace name under the second type of system. The correspondence between the namespace name before conversion and the above-mentioned namespace name can be: the namespace name before conversion is the same as the above-mentioned namespace name. Therefore, under the condition that the current namespace name needs to be converted, the preset namespace name conversion information for converting the current namespace name in the preset namespace name conversion information set can be determined.
[0075] The second step is to replace the above-mentioned namespace name with the converted namespace name included in the above-mentioned target preset namespace name conversion information. In practice, the above-mentioned execution entity can first delete the namespace name in the above-mentioned first layout file. Then, the above-mentioned converted namespace name can be added to the position corresponding to the above-mentioned namespace name in the above-mentioned first layout file. In this way, the current namespace name can be converted by the determined preset namespace name conversion information.
[0076] In some optional implementations of some embodiments, for each attribute name in the above-mentioned attribute names and attribute values, based on a preset attribute name conversion information set, wherein the preset attribute name conversion information in the preset attribute name conversion information set includes an attribute name before conversion and an attribute name after conversion, the execution subject may perform the following steps:
[0077] The first step is to determine the preset attribute name conversion information as the target preset attribute name conversion information in response to the presence of preset attribute name conversion information including a pre-conversion attribute name corresponding to the above attribute name in the above preset attribute name conversion information set. The above preset attribute name conversion information may be information for converting an attribute name in the first layout file into an attribute name under the second type system. The correspondence between the above pre-conversion attribute name and the above attribute name may be: the above pre-conversion attribute name is the same as the above attribute name. Thus, under the condition that the current attribute name needs to be converted, the preset attribute name conversion information for converting the current attribute name in the preset attribute name conversion information set may be determined.
[0078] The second step is to replace the attribute name with the converted attribute name included in the target preset attribute name conversion information. In practice, the execution entity may first delete the attribute name in the first layout file. Then, the converted attribute name may be added to the position corresponding to the attribute name in the first layout file. Thus, the current attribute name may be converted by the determined preset attribute name conversion information.
[0079] For each attribute value in the above attribute names and attribute values, based on a preset attribute value conversion information set, wherein the preset attribute value conversion information in the preset attribute value conversion information set includes a pre-conversion attribute value and a post-conversion attribute value, perform the following steps:
[0080] The first step is to determine the preset attribute value conversion information as the target preset attribute value conversion information in response to the presence of preset attribute value conversion information including a pre-conversion attribute value corresponding to the attribute value in the preset attribute value conversion information set. The preset attribute value conversion information may be information for converting an attribute value in a first layout file into an attribute value under a second type of system. The correspondence between the pre-conversion attribute value and the attribute value may be: the pre-conversion attribute value is the same as the attribute value. Thus, the preset attribute value conversion information for converting the current attribute value in the preset attribute value conversion information set may be determined under the condition that the current attribute value needs to be converted.
[0081] The second step is to replace the above attribute value with the converted attribute value included in the above target preset attribute value conversion information. In practice, the above execution entity may first delete the attribute value in the above first layout file. Then, the above converted attribute value may be added to the position corresponding to the above attribute value in the above first layout file. Thus, the current attribute value may be converted by the determined preset attribute value conversion information.
[0082] In some optional implementations of some embodiments, for each of the above-mentioned target identifiers, based on a preset identifier conversion information set, wherein the preset identifier conversion information in the preset identifier conversion information set includes a pre-conversion identifier and a post-conversion identifier, the execution subject may perform the following steps:
[0083] The first step is to determine the preset identifier conversion information as the target preset identifier conversion information in response to the presence of the preset identifier conversion information set including the pre-conversion identifier and the preset identifier corresponding to the target identifier. The preset identifier conversion information may be information for converting the target identifier in the first layout file into the target identifier under the second type system. The correspondence between the pre-conversion identifier and the target identifier may be: the pre-conversion identifier is the same as the target identifier. Thus, under the condition that the current target identifier needs to be converted, the preset identifier conversion information in the preset identifier conversion information set for converting the current target identifier may be determined.
[0084] The second step is to replace the target identifier with the converted identifier included in the target preset identifier conversion information. In practice, the execution entity may first delete the target identifier in the first layout file. Then, the converted identifier may be added to the position corresponding to the target identifier in the first layout file. Thus, the current target identifier may be converted by the determined preset identifier conversion information.
[0085] Through step 3011, each subtag name, namespace name, each attribute name and attribute value of the subtag and target identifier in the first layout file can be automatically converted to automatically generate a second layout file adapted to the second type of system.
[0086] Step 3012: Add the second layout file to the second target file directory.
[0087] In some embodiments, the execution entity may add the second layout file to a second target file directory. The second target file directory may be a file directory for storing the second layout file. It is understandable that the second target file directory may be the same as the first target file directory or may be different from the first target file directory. In practice, the execution entity may copy the second layout file to the second target file directory. Thus, the second layout file obtained after automatic conversion may be added to the corresponding file directory for page view rendering by the second type system.
[0088] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: through the layout file conversion method of some embodiments of the present disclosure, the page view development efficiency is improved and development resources are saved. Specifically, the reason for the low efficiency of page view development and the waste of development resources is that the layout file under another type of system needs to be rewritten according to the previously written layout file, resulting in low efficiency of page view development and waste of development resources. Based on this, the layout file conversion method of some embodiments of the present disclosure performs the following conversion steps for each first layout file in the first layout file set in the first target file directory: First, based on each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the above-mentioned first layout file, the above-mentioned first layout file is converted and processed to obtain the converted first layout file as the second layout file. Among them, the above-mentioned first layout file is used for page view rendering under the first type system, and the above-mentioned second layout file is used for page view rendering under the second type system. Thus, each sub-tag name, namespace name, each attribute name and attribute value of the sub-tag and the target identifier in the first layout file can be automatically converted to automatically generate a second layout file adapted to the second type system. Then, the second layout file is added to the second target file directory. Thus, the second layout file obtained after automatic conversion can be added to the corresponding file directory for the second type system to render the page view. Also, because the first layout file can be automatically converted to the second layout file, when developing the page view under the second type system, there is no need to rewrite the layout file. This improves the development efficiency of the page view and saves development resources.
[0089] Further references Figure 4, which shows a process 400 of another embodiment of a layout file conversion method. The process 400 of the layout file conversion method includes the following steps:
[0090] Step 401: Send preset prompt information to an associated display device.
[0091] In some embodiments, the execution body of the layout file conversion method (for example Figure 1 The computing device 101 shown in the figure can send the preset prompt information to the associated display device through a wired connection or a wireless connection. The preset prompt information is used to prompt the user to add the first layout file set to the first target file directory. For example, the prompt information can be "Please add the layout file to be converted to the file directory [D:\aa\bb]". The display device can be a device with a display function. For example, the display device can be a display screen associated with the execution subject. Thus, the user can be prompted to add the layout file to be converted to the specified file directory.
[0092] Step 402: Receive second layout file directory configuration information.
[0093] In some embodiments, the execution entity may receive the second layout file directory configuration information. In practice, the execution entity may receive the second layout file directory configuration information input by the user. The second layout file directory configuration information may be the address information of the second layout file directory. For example, the second layout file directory configuration information may be "D:\aa\cc". Thus, the second layout file directory may be set by the user.
[0094] Step 403: In response to the existence of a file directory corresponding to the second layout file directory configuration information, the file directory is determined as a second target file directory.
[0095] In some embodiments, the execution subject may determine the file directory as the second target file directory in response to the existence of the file directory corresponding to the second layout file directory configuration information. Thus, if the user-set file directory exists locally, the local file directory may be directly determined as the second target file directory.
[0096] Step 404: In response to the absence of a file directory corresponding to the second layout file directory configuration information, create a file directory as a second target file directory.
[0097] In some embodiments, the execution subject may create the file directory as the second target file directory in response to the absence of the file directory corresponding to the second layout file directory configuration information. Thus, the file directory may be created locally as the second target file directory when the file directory set by the user does not exist locally.
[0098] Step 405, for each first layout file in the first layout file set in the first target file directory, perform the following conversion steps: based on each sub-tag name, namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the first layout file, convert the first layout file to obtain the converted first layout file as the second layout file; add the second layout file to the second target file directory.
[0099] In some embodiments, the specific implementation of step 405 and the technical effects brought about can be referred to Figure 3 The corresponding step 301 in the embodiments will not be described in detail here.
[0100] from Figure 4 It can be seen that Figure 3 Compared with the description of some corresponding embodiments, Figure 4 The process 400 of the layout file conversion method in some corresponding embodiments embodies the steps of expanding the first target file directory and the second target file directory. Therefore, the scheme described in these embodiments can prompt the user to add the layout file to be converted to the specified file directory. The user can also set the second layout file directory for storing the converted layout file.
[0101] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a layout file conversion device. These device embodiments are similar to Figure 3 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.
[0102] like Figure 5As shown, the layout file conversion device 500 of some embodiments includes: an execution unit 501. The execution unit 501 is configured to perform the following conversion steps for each first layout file in the first layout file set in the first target file directory: a conversion unit 5011 is configured to convert the first layout file based on each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the first layout file, and obtain the converted first layout file as the second layout file, wherein the first layout file is used for page view rendering under the first type system, and the second layout file is used for page view rendering under the second type system; an adding unit 5012 is configured to add the second layout file to the second target file directory.
[0103] In an optional implementation of some embodiments, before the execution unit 501, the layout file conversion device 500 may further include: a sending unit (not shown in the figure), configured to send preset prompt information to an associated display device, wherein the preset prompt information is used to prompt the user to add the first layout file set to the above-mentioned first target file directory.
[0104] In an optional implementation of some embodiments, before the execution unit 501, the layout file conversion device 500 may further include: a receiving unit and a determining unit (not shown in the figure). The receiving unit is configured to receive the second layout file directory configuration information; the determining unit is configured to determine the file directory as the second target file directory in response to the existence of the file directory corresponding to the second layout file directory configuration information.
[0105] In an optional implementation of some embodiments, before executing unit 501, the layout file conversion device 500 may further include: a creation unit (not shown in the figure), which is configured to create the above-mentioned file directory as a second target file directory in response to the absence of a file directory corresponding to the above-mentioned second layout file directory configuration information.
[0106] In an optional implementation of some embodiments, before the conversion unit 5011, the conversion step also includes: matching the first layout file to obtain each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag and each target identifier.
[0107] In an optional implementation of some embodiments, the conversion unit 5011 may include: a first conversion sub-unit (not shown in the figure), configured to perform the following steps for each sub-tag name among the above-mentioned sub-tag names based on a preset sub-tag name conversion information set, wherein the preset sub-tag name conversion information in the above-mentioned preset sub-tag name conversion information set includes a pre-conversion sub-tag name and a post-conversion sub-tag name: in response to the presence of preset sub-tag name conversion information corresponding to the pre-conversion sub-tag name and the above-mentioned sub-tag name in the above-mentioned preset sub-tag name conversion information set, determine the above-mentioned preset sub-tag name conversion information as the target preset sub-tag name conversion information; replace the above-mentioned sub-tag name with the post-conversion sub-tag name included in the above-mentioned target preset sub-tag name conversion information.
[0108] In an optional implementation of some embodiments, the conversion unit 5011 may include: a second conversion sub-unit (not shown in the figure), configured to perform the following steps for each namespace name in the above-mentioned namespace names based on a preset namespace name conversion information set, wherein the preset namespace name conversion information in the above-mentioned preset namespace name conversion information set includes a namespace name before conversion and a namespace name after conversion: in response to the presence of preset namespace name conversion information corresponding to the namespace name before conversion included in the above-mentioned preset namespace name conversion information set, determining the above-mentioned preset namespace name conversion information as the target preset namespace name conversion information; replacing the above-mentioned namespace name with the converted namespace name included in the above-mentioned target preset namespace name conversion information.
[0109] In an optional implementation of some embodiments, the conversion unit 5011 may include: a third conversion subunit and a fourth conversion subunit (not shown in the figure). The third conversion subunit is configured to perform the following steps for each attribute name in the above-mentioned attribute names and attribute values based on a preset attribute name conversion information set, wherein the preset attribute name conversion information in the above-mentioned preset attribute name conversion information set includes a pre-conversion attribute name and a post-conversion attribute name: in response to the presence of preset attribute name conversion information including a pre-conversion attribute name corresponding to the above-mentioned attribute name in the above-mentioned preset attribute name conversion information set, determine the above-mentioned preset attribute name conversion information as the target preset attribute name conversion information; and replace the above-mentioned attribute name with the post-conversion attribute name included in the above-mentioned target preset attribute name conversion information. The fourth conversion sub-unit is configured to perform the following steps for each attribute value in the above-mentioned attribute names and attribute values based on a preset attribute value conversion information set, wherein the preset attribute value conversion information in the above-mentioned preset attribute value conversion information set includes a pre-conversion attribute value and a post-conversion attribute value: in response to the presence of preset attribute value conversion information including a pre-conversion attribute value corresponding to the above-mentioned attribute value in the above-mentioned preset attribute value conversion information set, determine the above-mentioned preset attribute value conversion information as the target preset attribute value conversion information; and replace the above-mentioned attribute value with the post-conversion attribute value included in the above-mentioned target preset attribute value conversion information.
[0110] In an optional implementation of some embodiments, the conversion unit 5011 may include: a fifth conversion subunit (not shown in the figure), configured to perform the following steps for each target identifier among the above-mentioned target identifiers based on a preset identifier conversion information set, wherein the preset identifier conversion information in the above-mentioned preset identifier conversion information set includes a pre-conversion identifier and a post-conversion identifier: in response to the presence of preset identifier conversion information corresponding to the pre-conversion identifier and the above-mentioned target identifier in the above-mentioned preset identifier conversion information set, determining the above-mentioned preset identifier conversion information as the target preset identifier conversion information; and replacing the above-mentioned target identifier with the post-conversion identifier included in the above-mentioned target preset identifier conversion information.
[0111] It is understood that the units described in the device 500 are similar to those described in the reference Figure 3 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 500 and the units included therein, and will not be described in detail here.
[0112] Reference below Figure 6 , which shows an electronic device (eg, Figure 1 Schematic diagram of the structure of the computing device 101)600. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0113] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0114] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0115] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0116] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0117] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0118] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: for each first layout file in the first layout file set in the first target file directory, perform the following conversion steps: based on each sub-tag name, namespace name, each attribute name and attribute value of each sub-tag, and each target identifier in the first layout file, convert the first layout file to obtain the converted first layout file as the second layout file, wherein the first layout file is used for page view rendering under the first type system, and the second layout file is used for page view rendering under the second type system; add the second layout file to the second target file directory.
[0119] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0121] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be set in a processor, for example, may be described as: a processor includes an execution unit. Wherein, the names of these units do not constitute a limitation on the unit itself in some cases, for example, the execution unit may also be described as "for each first layout file in the first layout file set in the first target file directory, perform the following conversion steps: based on each sub-tag name, namespace name, each attribute name and attribute value of each sub-tag and each target identifier in the above-mentioned first layout file, convert the above-mentioned first layout file to obtain the converted first layout file as the second layout file, wherein the above-mentioned first layout file is used for page view rendering under the first type of system, and the above-mentioned second layout file is used for page view rendering under the second type of system; add the above-mentioned second layout file to the unit of the second target file directory".
[0122] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0123] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A layout file conversion method, comprising: For each first layout file in the first layout file set in the first target file directory, perform the following conversion steps: Based on each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier in the first layout file, the first layout file is converted to obtain the converted first layout file as the second layout file, wherein the first layout file is used for page view rendering under a first type of system, the second layout file is used for page view rendering under a second type of system, the first layout file is a layout file under the first type of system, the first type of system is a system adapted by the previously written layout file, the second type of system is a system adapted by the converted layout file, and the second layout file is a layout file obtained by converting the first layout file, or a layout file saved separately after converting the first layout file; The second layout file is added to a second target file directory, wherein the second target file directory is a file directory for storing the second layout file.
2. The method according to claim 1, wherein: Before performing the following conversion step, the method further includes: Sending preset prompt information to an associated display device, wherein the preset prompt information is used to prompt a user to add the first layout file set to the first target file directory.
3. The method according to claim 1, wherein: Before performing the following conversion step, the method further includes: Receive second layout file directory configuration information; In response to the existence of a file directory corresponding to the second layout file directory configuration information, the file directory is determined as a second target file directory.
4. The method according to claim 3, wherein: Before performing the following conversion step, the method further includes: In response to the absence of a file directory corresponding to the second layout file directory configuration information, the file directory is created as a second target file directory.
5. The method according to claim 1, wherein: Before converting the first layout file, the converting step further includes: The first layout file is matched to obtain each sub-tag name, each namespace name, each attribute name and attribute value of each sub-tag, and each target identifier.
6. The method according to claim 1, wherein: The converting the first layout file includes: For each of the sub-tag names, based on a preset sub-tag name conversion information set, wherein the preset sub-tag name conversion information in the preset sub-tag name conversion information set includes a sub-tag name before conversion and a sub-tag name after conversion, the following steps are performed: In response to the preset sub-tag name conversion information set including the preset sub-tag name conversion information corresponding to the sub-tag name before conversion, determining the preset sub-tag name conversion information as the target preset sub-tag name conversion information; The sub-tag name is replaced with the converted sub-tag name included in the target preset sub-tag name conversion information.
7. The method according to claim 1, wherein: The converting the first layout file includes: For each of the namespace names, based on a preset namespace name conversion information set, wherein the preset namespace name conversion information in the preset namespace name conversion information set includes a namespace name before conversion and a namespace name after conversion, the following steps are performed: In response to the preset namespace name conversion information set including preset namespace name conversion information corresponding to the namespace name before conversion, determining the preset namespace name conversion information as the target preset namespace name conversion information; The namespace name is replaced with the converted namespace name included in the target preset namespace name conversion information.
8. The method according to claim 1, wherein: The converting the first layout file includes: For each attribute name in the attribute names and attribute values, based on a preset attribute name conversion information set, wherein the preset attribute name conversion information in the preset attribute name conversion information set includes an attribute name before conversion and an attribute name after conversion, the following steps are performed: In response to the preset attribute name conversion information set including preset attribute name conversion information corresponding to the attribute name before conversion, determining the preset attribute name conversion information as target preset attribute name conversion information; Replacing the attribute name with the converted attribute name included in the target preset attribute name conversion information; For each attribute value in each of the attribute names and attribute values, based on a preset attribute value conversion information set, wherein the preset attribute value conversion information in the preset attribute value conversion information set includes a pre-conversion attribute value and a post-conversion attribute value, perform the following steps: In response to the preset attribute value conversion information set including preset attribute value conversion information corresponding to the attribute value before conversion, determining the preset attribute value conversion information as target preset attribute value conversion information; The attribute value is replaced with the converted attribute value included in the target preset attribute value conversion information.
9. The method according to claim 1, wherein: The converting the first layout file includes: For each target identifier in the target identifiers, based on a preset identifier conversion information set, wherein the preset identifier conversion information in the preset identifier conversion information set includes a pre-conversion identifier and a post-conversion identifier, the following steps are performed: In response to the preset identifier conversion information set including the preset identifier conversion information corresponding to the target identifier, determining the preset identifier conversion information as the target preset identifier conversion information; The target identifier is replaced with the converted identifier included in the target preset identifier conversion information.
10. A layout file conversion device, comprising: The execution unit is configured to perform the following conversion steps for each first layout file in the first layout file set in the first target file directory: a conversion unit configured to convert the first layout file based on each subtag name, each namespace name, each attribute name and attribute value of each subtag, and each target identifier in the first layout file, to obtain the converted first layout file as the second layout file, wherein the first layout file is used for page view rendering under a first type of system, the second layout file is used for page view rendering under a second type of system, the first layout file is a layout file under the first type of system, the first type of system is a system adapted by the previously written layout file, the second type of system is a system adapted by the converted layout file, and the second layout file is a layout file obtained by converting the first layout file, or a layout file saved separately after converting the first layout file; The adding unit is configured to add the second layout file to a second target file directory, wherein the second target file directory is a file directory for storing the second layout file.
11. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.
12. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Method and relevant device for obtaining data format
CN108628900A
