我有两个XML文件,我想将指定的值从一个XML文件传输到名称匹配的另一个XML文件。如果游戏没有匹配的值,我想要添加标签,但它应该是空的。
有人知道我该怎么做吗?
以下是一个例子:
data.xml中
<products>
<product>
<title>iPhone 7</title>
<desc>Here is a desc</desc>
</product>
<product>
<title>iPhone 6</title>
</product>
</products>
我想在名称匹配的XML文件中传输desc
的值。如果desc
文件中的data.xml
中没有值,我想将""
添加到here.xml
文件中。像这样:
here.xml
<products>
<product>
<title>iPhone 7</title>
<desc>Here is a desc</desc>
</product>
<product>
<title>iPhone 6</title>
<desc></desc>
</product>
</products>
问候,谢谢!