You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Saha, Sanjeev" <ss...@asce.org> on 2005/05/20 21:20:21 UTC

fails to validate minOccurs='0'

For schema:

 

  <xs:complexType name="Invoice_Type">

    <xs:all>

      <xs:element name="InvoiceNum" type="INV_NO_Type" minOccurs="0"/>

      <xs:element name="InvoiceClass" type="INV_CLASS_Type"/>

      <xs:element name="Warehouse" type="WARE_NO_Type"/>

    </xs:all>

  </xs:complexType>

 

Where INV_NO_Type is defined as an Integer, I get the following error if
I leave out the <InvoiceNum/> tag from the XML.

 

java.lang.Exception: Xml NOT valid for the following reason(s):

            error: Expected element InvoiceNum at the end of the content
in element Invoice

 

 

However, if I replace <xs:all/> with <xs:sequence/> it seems to work
without any problem. Any clues anyone?

 

Regards, 
Sanjeev

 


Re: fails to validate minOccurs='0'

Posted by su...@tcs.com.
Hi,
What it seems from the xsd, is that the InvoiceNum is a mandatory field. 
The XML parser expects a value for this tag. That is one reason you got 
the error.
However you pointed out that if you replace <xs:all> by <xs:sequence>, you 
are not getting the error. I have tried the same thing, I got the error in 
both the cases. Can you please send the xml file which you are going to 
validate?

Warm Regards,
Sujoy Banerjee



"Saha, Sanjeev" <ss...@asce.org> 
05/21/2005 12:50 AM
Please respond to
user@xmlbeans.apache.org


To
<us...@xmlbeans.apache.org>
cc

Subject
<xs:all> fails to validate minOccurs='0'






For schema:
 
  <xs:complexType name="Invoice_Type">
    <xs:all>
      <xs:element name="InvoiceNum" type="INV_NO_Type" minOccurs="0"/>
      <xs:element name="InvoiceClass" type="INV_CLASS_Type"/>
      <xs:element name="Warehouse" type="WARE_NO_Type"/>
    </xs:all>
  </xs:complexType>
 
Where INV_NO_Type is defined as an Integer, I get the following error if I 
leave out the <InvoiceNum/> tag from the XML.
 
java.lang.Exception: Xml NOT valid for the following reason(s):
            error: Expected element InvoiceNum at the end of the content 
in element Invoice
 
 
However, if I replace <xs:all/> with <xs:sequence/> it seems to work 
without any problem. Any clues anyone?
 
Regards, 
Sanjeev
 
ForwardSourceID:NT0000CCAA 


Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information.   If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited.   If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments.  Thank you