我有以下 xml 字符串。我想将其转换为 java 对象,以将每个标签与该对象的字段映射。与标签名称相比,如果我可以引入不同的字段名称,那就更好了。我怎么能这样做?我正在查看 JAXB,但我仍然对“ns4:response”之类的部分和标签中的标签感到困惑。先感谢您...
<ns4:response>
<count>1</count>
<limit>1</limit>
<offset>1</offset>
<ns3:payload xsi:type="productsPayload">
<products>
<product>
<avgRating xsi:nil="true"/>
<brand>Candie's</brand>
<description>
<longDescription>
long descriptions
</longDescription>
<shortDescription>
short description
</shortDescription>
</description>
<images>
<image>
<altText>alternate text</altText>
<height>180.0</height>
<url>
url
</url>
<width>180.0</width>
</image>
</images>
<price>
<clearancePrice xsi:nil="true"/>
<regularPrice xsi:nil="true"/>
<salePrice>28.0</salePrice>
</price>
</product>
</products>
</ns3:payload>
</ns4:response>