2011-05-30 19 views
9

hassas Bu (bütün değil) benim xml geçerli: rekVrednostDdv hassasiyet 2. olmalıdır Örneğinxml şema, ondalık değer

<xsd:complexType name="xx"> 
    <xsd:complexContent> 
     <xsd:extension base="tns:xx"> 
     <xsd:sequence> 
      <xsd:element name="rekVrednostDdv" nillable="true" type="decimal"/> 
      <xsd:element name="xx" nillable="true" type="dateTime"/> 
      <xsd:element name="xx" nillable="true" type="decimal"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="dateTime"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="decimal"/> 
      <xsd:element name="xx" nillable="true" type="decimal"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="decimal"/> 
      <xsd:element name="xx" nillable="true" type="tns:xx"/> 
      <xsd:element name="xx" nillable="true" type="dateTime"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
      <xsd:element name="xx" nillable="true" type="string"/> 
     </xsd:sequence> 
     </xsd:extension> 
    </xsd:complexContent> 
    </xsd:complexType> 

Nasıl hassasiyetli 2.

için bu tür söyleyebilirim i http://www.brainbell.com/tutorials/XML/Working_With_Simple_Types.htm

Invalid XML schema: 'Element <xsd:precision> is not allowed under element <xsd:restriction>.' 
kullanırken

<xsd:element name="rekVrednostDdv" nillable="true"> 
        <xsd:simpleType> 
         <xsd:restriction base="decimal"> 
          <xsd:precision value="6"/> 
          <xsd:scale value="2"/> 
         </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 

ama şimdi olsun: böyle deneyin

cevap

15

xs:decimal'u kısıtlayan ve hassaslığı tanımlamak için <xs:fractionDigits/>'u kullanan yeni ve basit bir tür oluşturun. Ardından eleman tanımınızda bu türe bakın.

<xs:simpleType name="decimalTwoPrec"> 
    <xs:restriction base="xs:decimal"> 
     <xs:fractionDigits value="2" /> 
    </xs:restriction> 
</xs:simpleType> 

<xs:element name="rekVrednostDdv" nillable="true" type="decimalTwoPrec"/> 

fazla bilgi için, Spec yardım için http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits

+0

Thx bakın. Ben ekledim ve şimdi düşünüyorum. – senzacionale

İlgili konular