<xs:element name="CustomAttributes" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>
xjc生成类:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"any"
})
public static class CustomAttributes {
@XmlAnyElement(lax = true)
protected Object any;
}
我尝试将这个json解组为xml
"custom_attributes" :{
"attributes":{
"aaa":"2",
"bbb": "eee"
}
}
我创建了另一个方案来使其工作。
<xs:element name="Attributes">
<xs:complexType>
<xs:sequence>
<xs:element name="aaa" type="xs:string" minOccurs="0" />
<xs:element name="bbb" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
并生成一个类,但取消编组无效