我正在使用 JSONIX 编组和解组 XML 文件。到目前为止,它工作得很好。我缺少的是获得默认值和限制的可能性,例如 minOccours 和 maxOccours-Values。JSONIX 有可能吗?
这些属性:
<xsd:sequence>
<xsd:element name="inflowMin" type="framework:flowType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="inflowMax" type="framework:flowType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="unitOfFlowControl" type="framework:flowUnit" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="waterCosts" type="xsd:double" default="0.0"/>
<xsd:attribute name="controllable" type="xsd:boolean" default="0"/>
<xsd:attribute name="scalingOfControl" type="xsd:double" default="1.0" />
得到:
propertyInfos: [{
type: 'element',
name: 'inflowMin',
elementName: 'inflowMin',
typeInfo: ...
}, {
type: 'element',
name: 'inflowMax',
elementName: 'inflowMax',
typeInfo: ...
}, {
type: 'element',
name: 'unitOfFlowControl',
elementName: 'unitOfFlowControl',
typeInfo: 'String'
}, {
name: 'waterCosts',
typeInfo: 'Double',
attributeName: 'waterCosts',
type: 'attribute'
}, {
name: 'controllable',
typeInfo: 'Boolean',
attributeName: 'controllable',
type: 'attribute'
}, {
name: 'scalingOfControl',
typeInfo: 'Double',
attributeName: 'scalingOfControl',
type: 'attribute'
}]
}
谢谢!