0
我有下面的模式元素,我想給它添加一個屬性。如何添加屬性到這個元素(模式)
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="Product" maxOccurs="1" minOccurs="0" >
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:ComplexType>
眼下生成的XML看起來像:
<Product>This is the Product Translation for 001</Product>
我想生成的XML看起來像:
<Product code="001">This is the Product Translation for 001</Product>
當我使用JAXB創建對象時,這需要我爲name =「code」創建一個新對象。有沒有辦法避免這種情況? – user2170437 2013-04-22 13:47:17
對不起,我不知道。 – collapsar 2013-04-22 14:15:20