如何生成List <list <double>&gt;用apache cxf

时间:2017-05-19 10:03:54

标签: java apache xsd cxf

我正在尝试使用apache cxf生成List<List<Double>>

以下xsd会生成List<Double>

<xsd:complexType name="Geometry">
    <xsd:sequence>
        <xsd:element name="type" minOccurs="1" type="xsd:string"/>
        <xsd:element name="coordinates" minOccurs="1">
            <xsd:simpleType>
                <xsd:list>
                    <xsd:simpleType>
                        <xsd:list itemType="xsd:double"/>
                    </xsd:simpleType>
                </xsd:list>
            </xsd:simpleType>
        </xsd:element>
    </xsd:sequence>
</xsd:complexType>

如果我将maxOccurs="unbounded"添加到元素坐标,我会得到List<JAXBElement<List<Double>>> coordinates

如何生成List<List<Double>>

1 个答案:

答案 0 :(得分:0)

架构说坐标可以包含双打列表的列表,这基本上是指双打列表。

更改maxoccurs =“unbounded”将显着改变XML

<coordinates>1 2 3</coordinates>

现在可以

<coordinates>1</coordinates>
<coordinates>2 3</coordinates>

到目前为止生成的内容看起来是否正确,您想要使XML看起来像什么?

相关问题