我有一个 xml,我想将由特定标签的子级形成的子 xml 保存到一个字符串中。这是一个 xml 示例:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SampleDTO>
<id>1</id>
<someList>
<someObject>
<amount>32</amount>
<id>1</id>
<someDescription>I am a description</someDescription>
</someObject>
<someObject>
<amount>66</amount>
<id>2</id>
<someDescription>I am another description</someDescription>
</someObject>
<someObject>
<amount>78</amount>
<id>13</id>
<someDescription>Guess what? I am a description</someDescription>
</someObject>
</someList>
<otherList>
<otherObject>
<flag>true</flag>
<id>1</id>
<otherDescription>Oh nice, a description</otherDescription>
</otherObject>
</otherList>
</SampleDTO>
我想通过例如“someList”将子xml元素和值保存到字符串中,因为接下来我将它反序列化为java对象
喵喵时光机
慕村225694
慕标5832272
相关分类