You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Luís Pereira <lu...@opensoft.pt> on 2003/06/30 23:57:29 UTC
Attribute must appear/not allowed ?????
Hello,
I've tried to submit the following bug but the forms are just too complex
and I couldn't understand (everyone has it's limitations) how to send an
attachment example, so I'm sending it here.
It consists of the following:
1. I've Defined a Schema called Declaration.xsd that you can find in
examples.jar, where I've put a simple type (ValueType, a decimal with 13
of max size and 2 of precision)
<xs:simpleType name="ValueType">
<xs:restriction base="xs:decimal">
<xs:minExclusive value="0.00"/>
<xs:totalDigits value="13"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
</xs:simpleType>
2. Then wdefined an Element of that type (Amount), whith a restriction to
have an attribute date that is required and...
<xs:element name="Amount" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="ValueType">
<xs:attribute name="date" use="required">
<xs:simpleType>
<xs:restriction base="xs:date"/>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Guess what happens... (you wont, you can run this example using the
following cmd):
java -cp example.jar;xercesImpl.jar;xmlParserApi.jar Validator
And amazingly for a simple xml file (that you can find inside the jar),
the output will be:
[Error] :4:28: cvc-complex-type.3.2.2: Attribute 'date' is not allowed to
appear in element 'Amount'.
[Error] :4:28: cvc-complex-type.4: Attribute 'date' must appear on element
'Amount'.
[Error] :5:28: cvc-complex-type.3.2.2: Attribute 'date' is not allowed to
appear in element 'Amount'.
[Error] :5:28: cvc-complex-type.4: Attribute 'date' must appear on element
'Amount'.
Can anyone tell me why is this happening ????
Best Regards,
Luís Pereira