gpt4 book ai didi

java - JIBX 绑定(bind)和 Google 通讯录(使用Flexible=true)

转载 作者:行者123 更新时间:2023-12-01 19:00:25 25 4
gpt4 key购买 nike

我有一个简单的绑定(bind):

<binding>
<mapping name="entry" class="google.vo.GoogleContactsEntry" ordered="false">
<value name="title" field="title" usage="optional" />
<value name="email" field="email" usage="optional" />
</mapping>


<mapping name="feed" class="google.vo.GoogleContacts" ordered="false" flexible="true">
<namespace uri="http://www.w3.org/2005/Atom" default="elements"/>
<value name="id" field="id" usage="optional" />
<value name="updated" field="updatedString" usage="optional" />
<value name="title" field="title" usage="optional" />
<collection item-type="google.vo.GoogleContactsEntry" name="entries" field="entries"/>
</mapping>
</binding>

问题出在 Collection 元素中,它需要 name="entries"。 Google 返回没有包装元素的条目。就像这样:

<feed>

<entry>

</entry>

<entry>

</entry>

</feed>

JiBX 预计:

<feed>
<entries>
<entry>

</entry>

<entry>

</entry>
<entries>
</feed>

集合中的绑定(bind)方案中没有元素名称,JiBX 无法编译。有解决办法吗?

最佳答案

更好的解决方案是使用 xsl 转换并将您的传入响应更改为 jibx 所期望的,它应该很简单。

本主题将帮助: How can I wrap a group of adjacent elements using XSLT?

关于java - JIBX 绑定(bind)和 Google 通讯录(使用Flexible=true),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12456251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com