相关疑难解决方法(0)

Java中的XML序列化?

.NET的XML序列化的Java模拟是什么?

java xml serialization

102
推荐指数
5
解决办法
13万
查看次数

将xml字符串转换为Java对象

我有以下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>
Run Code Online (Sandbox Code Playgroud)

java xml string jaxb

7
推荐指数
1
解决办法
4万
查看次数

标签 统计

java ×2

xml ×2

jaxb ×1

serialization ×1

string ×1