2013-03-20 185 views
0

在我的xml我有一个价格标签,我想做出限制在十进制数字量和一种货币,我有这样的:复杂类型的模式

`<unit_price currency="$"> 4.00 </unit_price>` 

在XSD I'm出现此错误:

E [Xerces] cos-applicable-facets:facet'fractionDigits'不允许通过类型#AnonType_Price。

这是我的代码,pl如何修复它? Thnks。

<xsd:complexType name="basePrice"> 
    <xsd:simpleContent> 
     <xsd:extension base="xsd:double"> 
      <xsd:attribute name="currency" fixed="$"/> 
     </xsd:extension> 
    </xsd:simpleContent> 
</xsd:complexType> 

<xsd:complexType name="Price"> 
    <xsd:simpleContent> 
     <xsd:restriction base="basePrice"> 
      *<xsd:fractionDigits value="2"/>* 
     </xsd:restriction > 
    </xsd:simpleContent> 
</xsd:complexType> 

回答

1

您不能限制双精度小数的位数,只能用小数。这是因为当数字以十进制表示法表示时,计数数字只是一个有意义的操作。