我有一个 XML 模板,其中预定义了一些字段。我想基于它使用新Value
值的模板构建新的 XML RewriteRules
。
前任。模板:
val template = <xml>
<Persons>
<Name>Persons</Name>
<Person>
<FullName>
<Name>Name of the field</Name>
<Value></Value>
</FullName>
<LastName>
<Name>Name of the field</Name>
<Value></Value>
</LastName>
</Person>
</Persons>
</xml>
case class Person(fullName: String, lastName: String)
val persons = Seq(Person("John Smith", "Smith"), Person("Bob Saver", "Saver"))
输出应该是:
<xml>
<Persons>
<Name>Persons</Name>
<Person>
<FullName>
<Name>Name of the field</Name>
<Value>John Smith</Value>
</FullName>
<LastName>
<Name>Name of the field</Name>
<Value>Smith</Value>
</LastName>
</Person>
<Person>
<FullName>
<Name>Name of the field</Name>
<Value>Bob Saver</Value>
</FullName>
<LastName>
<Name>Name of the field</Name>
<Value>Saver</Value>
</LastName>
</Person>
</Persons>
</xml>
有可能RewriteRules
吗?