我想知道是否可以使用 RABL 来呈现这样的 xml(不要问我为什么需要这种混乱的结构:D):
<garbagebox>
<user><id>1</id></user>
<user><id>2</id></user>
<article><name>some name here</name></article>
<customer><rich>yes</rich></customer>
<article><name>some name here #2</name></article>
</garbagebox>
现在看起来 rabl 禁止在单个父项中具有相同名称的多个节点(集合除外 - 但在集合中所有节点的名称都相同)
例如,如果我这样做:
object :garbagebox
child(Country.first) {attributes :id, :currency}
child(Customer.last) {attributes :id, :name}
child(Country.first) {attributes :id, :currency}
我只得到 2 个孩子而不是 3 个。
有人可以提供任何提示,以便我可以呈现这样的 xml 吗?谢谢。