title: Error in XML Schema Validation
body: <p>I have a particular Java class like</p>
  
  <pre><code>public class JavaClass implements Serializable{
  
  
      private static final long serialVersionUID = 1L;
      private ElementC ElementC = null;
      private ArrayList&lt;ElementA&gt; elementA = new ArrayList&lt;ElementA&gt;();
      private ArrayList&lt;ElementB&gt; elementB = new ArrayList&lt;ElementB&gt;();
  </code></pre>
  
  <p>and an XSD generated along with WSDL for the particular class, something like below.</p>
  
  <p>(XSD File)</p>
  
  <pre><code>&lt;xs:complexType name="JavaClass"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="ElementA" type="tns:elementA" nillable="true" minOccurs="0" maxOccurs="unbounded"/&gt;
        &lt;xs:element name="ElementB" type="tns:elementB" nillable="true" minOccurs="1" maxOccurs="unbounded"/&gt;
        &lt;xs:element name="ElementC" type="xs:string" minOccurs="1"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>Below is the chunk of Java code am using for schema validation.</p>
  
  <p>When I debug to peek in the parse exception thrown, The message says </p>
  
  <p><strong>One of '{elementA, elementB}' is expected</strong>. (<em>I suppose the problem is in SAXParseException.</em>)</p>
  
  <pre><code>public void warning(SAXParseException e) throws SAXException {
          //System.out.println("In Warning() of SchemaErrorHandler");
          // Store warnings in the packet so that they can be retrieved from the endpoint        
          packet.invocationProperties.put("WARNING", e);    
      }
      public void error(SAXParseException e) throws SAXException 
      {
          count++;
  
          String error = e.getMessage();
  
          if(error.contains("cvc-enumeration-valid")){
              StringTokenizer st = new StringTokenizer(error,"[");
              st.nextElement();
              StringTokenizer st2 = new StringTokenizer(st.nextElement().toString(),"]");
              exceptionTypeDetails = (String) st2.nextElement();
  </code></pre>
  
  <p>Now when I trigger a SOAP request without <strong>ElementB</strong>(<em>Mandatory</em>) the SOAP throws an error saying "<strong>ElementA</strong> was not found, Excepted ElementA"(Even though ElementA is non Mandatory).</p>
  
  <p>Please halp how can I debug the issue. Let me know incase of futher clarrifications needed on this question.</p>