java - 是否可以将动态值从 .properties 文件传递给 xml 文件的标签
问题描述
我有大约 100 个带有重复静态值的纯 xml 文件。我想通过从 .properties 文件中获取值将它们更改为动态值,以便我可以在一个地方更改该值。可能吗??
我拥有的当前 xml 示例:
<?xml version="1.0"?>
<bookstore>
<book category="children">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
**desired change:**
**prop.properties.com**
bookName=Harry Potter
authorName=J K. Rowling
yearValue=2005
priceValue=29.99
<?xml version="1.0"?>
<bookstore>`enter code here`
//load properies file
<book category="children">
<title>${bookName}</title>
<author>${authorName}</author>
<year>${yearValue}</year>
<price>${priceValue}</price>
</book>
</bookstore>
解决方案
推荐阅读
- kdb - 如何将此嵌套查询转换为单个查询(模拟MySql窗口函数)?
- sql - 是否可以使用封闭的 SQL 子查询中的值作为其包含查询的表名
- .net - 托管的 Blazor wasm 应用程序基本路径在本地工作,但不能作为 IIS 子应用程序
- java-platform-module-system - 如何在 Jigsaw 静态站点生成器中实现标签云
- reactjs - 打字稿类型 T 不能分配给匿名函数中的类型 T&U
- c# - 我怎样才能使这个 linq 查询更干净、更可重用?
- powershell - 使用 Invoke-WebRequest 发布多部分表单会生成内容类型异常
- python - Python中没有反向序列的排列
- flow-project - 为什么加速度总是抖动
- .net - Service Bus messages filtering by label