In your schema, you specified attributeFormDefault="qualified", which means
that local attribute declarations belong to the target namespace of the
schema. Specifically, attribute "date" has target namespace
"http://www.example.com/2002/Declaration";.

But in your instance, the "date" attribute doesn't have a prefix, so it
doesn't have a namespace, hence doesn't match the required "date"
attribute. (Note that default namespace declaration doesn't apply to
attributes.)

HTH,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]



                                                                                
                                                
                      "Lu�s Pereira"                                            
                                                
                      <[EMAIL PROTECTED]        To:       <[EMAIL PROTECTED]>   
                                      
                      nsoft.pt>                cc:                              
                                                
                                               Subject:  Attribute must 
appear/not allowed ?????                                
                      06/30/2003 05:57                                          
                                                
                      PM                                                        
                                                
                      Please respond to                                         
                                                
                      xerces-j-user                                             
                                                
                                                                                
                                                
                                                                                
                                                




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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

#### example.jar has been removed from this note on June 30 2003 by Sandy
Gao



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to