[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    Retrieving XML Validation Errors programatically - Updates after code review
From:       Dutta Satadip <s-dutta () sbcglobal ! net>
Date:       2004-03-23 7:04:13
Message-ID: 20040323070413.78160.qmail () web80411 ! mail ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello !!
The changes for the enhancement for retrieving XML validation errors programatically are attached. 
 
With Regards
dutta:)
 
 
 



[Attachment #5 (text/html)]

<DIV>
<DIV>
<DIV>Hello !!</DIV>
<DIV>The changes for the enhancement for retrieving XML validation errors \
programatically are attached. </DIV> <DIV>&nbsp;</DIV>
<DIV>With Regards</DIV>
<DIV>dutta:)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV></DIV>
--0-60549113-1080025453=:77601--


["validator.patch.txt" (text/plain)]

cvs diff -cNR 
? build
? changes
? changes.zip
? new
? jam_old/build
? src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.current
? src/xmlpublic/org/apache/xmlbeans/XmlValidationError.java
? xkit/schemas/easypo/easypo.jar
? xkit/schemas/easypo/instancepo.xml
? xkit/schemas/easypo/sample.xsd
? xkit/schemas/easypo/samplem.xml
? xkit/schemas/easypo/tt
? xkit/schemas/easypo/xmltypes.jar
cvs server: Diffing .
cvs server: Diffing bin
cvs server: Diffing docs
cvs server: Diffing docs/guide
cvs server: Diffing docs/images
cvs server: Diffing external
cvs server: Diffing external/lib
cvs server: Diffing jam
cvs server: Diffing jam/external
cvs server: Diffing jam/external/lib
cvs server: Diffing jam/license
cvs server: Diffing jam/src
cvs server: Diffing jam/src/org
cvs server: Diffing jam/src/org/apache
cvs server: Diffing jam/src/org/apache/xmlbeans
cvs server: Diffing jam/src/org/apache/xmlbeans/impl
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/annotation
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/internal
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/internal/classrefs
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/internal/elements
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/internal/parser
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/mutable
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/provider
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/tools
cvs server: Diffing jam/src/org/apache/xmlbeans/impl/jam/visitor
cvs server: Diffing jam/test
cvs server: Diffing jam/test/dummy15classes
cvs server: Diffing jam/test/dummy15classes/org
cvs server: Diffing jam/test/dummy15classes/org/apache
cvs server: Diffing jam/test/dummy15classes/org/apache/xmlbeans
cvs server: Diffing jam/test/dummy15classes/org/apache/xmlbeans/test
cvs server: Diffing jam/test/dummy15classes/org/apache/xmlbeans/test/jam
cvs server: Diffing jam/test/dummy15classes/org/apache/xmlbeans/test/jam/dummyclasses
cvs server: Diffing jam/test/dummy15classes/org/apache/xmlbeans/test/jam/dummyclasses/jsr175
 cvs server: Diffing jam/test/dummyclasses
cvs server: Diffing jam/test/dummyclasses/org
cvs server: Diffing jam/test/dummyclasses/org/apache
cvs server: Diffing jam/test/dummyclasses/org/apache/xmlbeans
cvs server: Diffing jam/test/dummyclasses/org/apache/xmlbeans/test
cvs server: Diffing jam/test/dummyclasses/org/apache/xmlbeans/test/jam
cvs server: Diffing jam/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses
cvs server: Diffing jam/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses/ejb
 cvs server: Diffing jam/test/tests
cvs server: Diffing jam/test/tests/org
cvs server: Diffing jam/test/tests/org/apache
cvs server: Diffing jam/test/tests/org/apache/xmlbeans
cvs server: Diffing jam/test/tests/org/apache/xmlbeans/test
cvs server: Diffing jam/test/tests/org/apache/xmlbeans/test/jam
cvs server: Diffing jam/website
cvs server: Diffing jam/website/old
cvs server: Diffing jam_old
cvs server: Diffing jam_old/docs
cvs server: Diffing jam_old/external
cvs server: Diffing jam_old/external/lib
cvs server: Diffing jam_old/src
cvs server: Diffing jam_old/src/org
cvs server: Diffing jam_old/src/org/apache
cvs server: Diffing jam_old/src/org/apache/xmlbeans
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/editable
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/editable/impl
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/editable/impl/ref
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/internal
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/internal/javadoc
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/internal/parser
cvs server: Diffing jam_old/src/org/apache/xmlbeans/impl/jam_old/provider
cvs server: Diffing jam_old/test
cvs server: Diffing jam_old/test/dummy15classes
cvs server: Diffing jam_old/test/dummy15classes/org
cvs server: Diffing jam_old/test/dummy15classes/org/apache
cvs server: Diffing jam_old/test/dummy15classes/org/apache/xmlbeans
cvs server: Diffing jam_old/test/dummy15classes/org/apache/xmlbeans/test
cvs server: Diffing jam_old/test/dummy15classes/org/apache/xmlbeans/test/jam
cvs server: Diffing jam_old/test/dummy15classes/org/apache/xmlbeans/test/jam/dummyclasses
 cvs server: Diffing \
jam_old/test/dummy15classes/org/apache/xmlbeans/test/jam/dummyclasses/jsr175 cvs \
server: Diffing jam_old/test/dummyclasses cvs server: Diffing \
jam_old/test/dummyclasses/org cvs server: Diffing \
jam_old/test/dummyclasses/org/apache cvs server: Diffing \
jam_old/test/dummyclasses/org/apache/xmlbeans cvs server: Diffing \
jam_old/test/dummyclasses/org/apache/xmlbeans/test cvs server: Diffing \
jam_old/test/dummyclasses/org/apache/xmlbeans/test/jam cvs server: Diffing \
jam_old/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses cvs server: \
Diffing jam_old/test/dummyclasses/org/apache/xmlbeans/test/jam/dummyclasses/ejb cvs \
server: Diffing jam_old/test/tests cvs server: Diffing jam_old/test/tests/org
cvs server: Diffing jam_old/test/tests/org/apache
cvs server: Diffing jam_old/test/tests/org/apache/xmlbeans
cvs server: Diffing jam_old/test/tests/org/apache/xmlbeans/test
cvs server: Diffing jam_old/test/tests/org/apache/xmlbeans/test/jam
cvs server: Diffing src
cvs server: Diffing src/binding
cvs server: Diffing src/binding/org
cvs server: Diffing src/binding/org/apache
cvs server: Diffing src/binding/org/apache/xmlbeans
cvs server: Diffing src/binding/org/apache/xmlbeans/impl
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding/bts
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding/compile
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding/joust
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding/logger
cvs server: Diffing src/binding/org/apache/xmlbeans/impl/binding/tylar
cvs server: Diffing src/common
cvs server: Diffing src/common/org
cvs server: Diffing src/common/org/apache
cvs server: Diffing src/common/org/apache/xmlbeans
cvs server: Diffing src/common/org/apache/xmlbeans/impl
cvs server: Diffing src/common/org/apache/xmlbeans/impl/common
cvs server: Diffing src/configschema
cvs server: Diffing src/configschema/schema
cvs server: Diffing src/jeti
cvs server: Diffing src/jeti/org
cvs server: Diffing src/jeti/org/apache
cvs server: Diffing src/jeti/org/apache/xmlbeans
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl/jeti
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl/jeti/logging
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl/jeti/logging/provider
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl/jeti/output
cvs server: Diffing src/jeti/org/apache/xmlbeans/impl/jeti/parameter
cvs server: Diffing src/license
cvs server: Diffing src/marshal
cvs server: Diffing src/marshal/org
cvs server: Diffing src/marshal/org/apache
cvs server: Diffing src/marshal/org/apache/xmlbeans
cvs server: Diffing src/marshal/org/apache/xmlbeans/impl
cvs server: Diffing src/marshal/org/apache/xmlbeans/impl/marshal
cvs server: Diffing src/marshal/org/apache/xmlbeans/impl/marshal/util
cvs server: Diffing src/marshal/org/apache/xmlbeans/impl/marshal/util/collections
cvs server: Diffing src/marshal/org/apache/xmlbeans/impl/richParser
cvs server: Diffing src/newstore2
cvs server: Diffing src/newstore2/org
cvs server: Diffing src/newstore2/org/apache
cvs server: Diffing src/newstore2/org/apache/xmlbeans
cvs server: Diffing src/newstore2/org/apache/xmlbeans/impl
cvs server: Diffing src/newstore2/org/apache/xmlbeans/impl/newstore2
cvs server: Diffing src/repackage
cvs server: Diffing src/repackage/repackage
cvs server: Diffing src/saaj_api
cvs server: Diffing src/saaj_api/javax
cvs server: Diffing src/saaj_api/javax/xml
cvs server: Diffing src/saaj_api/javax/xml/soap
cvs server: Diffing src/toolschema
cvs server: Diffing src/typeimpl
cvs server: Diffing src/typeimpl/org
cvs server: Diffing src/typeimpl/org/apache
cvs server: Diffing src/typeimpl/org/apache/xmlbeans
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl/regex
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl/schema
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl/util
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl/validator
Index: src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java
===================================================================
RCS file: /home/cvspublic/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java,v
 retrieving revision 1.9
diff -c -r1.9 Validator.java
*** src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java	23 Mar 2004 \
                02:42:45 -0000	1.9
--- src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java	23 Mar 2004 \
                06:52:08 -0000
***************
*** 12,17 ****
--- 12,21 ----
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
+ /*
+ * Enhancement for adding functionality to retrieve xml validation errors
+ * programatically contributed by Dutta Satadip
+ */
  
  package org.apache.xmlbeans.impl.validator;
  
***************
*** 53,58 ****
--- 57,63 ----
  import org.apache.xmlbeans.SchemaType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlError;
+ import org.apache.xmlbeans.XmlValidationError;
  import org.apache.xmlbeans.XmlObject;
  import org.apache.xmlbeans.XmlOptions;
  import org.apache.xmlbeans.SimpleValue;
***************
*** 93,99 ****
      {
          public void invalid ( String message )
          {
!             Validator.this.emitError( _event, message );
          }
  
          Event _event;
--- 98,117 ----
      {
          public void invalid ( String message )
          {
!           // TODO Addtional Attributes for validation error have limited \
                information
!          //at this time but will be a part of the second round of refactoring
! 
! 
!             Validator.this.emitError
!                 (
!                 _event,
!                 message,
!                 null,
!                 null,
!                 null,
!                 XmlValidationError.ATTRIBUTE_TYPE_INVALID,
!                 null
!                 );
          }
  
          Event _event;
***************
*** 104,115 ****
          return !_invalid && _constraintEngine.isValid();
      }
  
!     private void emitError ( Event event, String msg )
!     {
!         emitError(event, msg, XmlError.SEVERITY_ERROR);
      }
  
!     private void emitError ( Event event, String msg, int severity )
      {
          _errorState++;
  
--- 122,145 ----
          return !_invalid && _constraintEngine.isValid();
      }
  
!     private void emitError ( Event event, String msg,
!                              QName offendingQName, SchemaType expectedSchemaType ,
!                              List expectedQNames , int errorType,
!                              SchemaType badSchemaType)
!     {
!         emitError(event, msg, XmlError.SEVERITY_ERROR,
!                   offendingQName , expectedSchemaType,
!                   expectedQNames , errorType,
!                   badSchemaType
!         );
! 
      }
  
!     private void emitError ( Event event, String msg, int severity,
!                              QName offendingQName, SchemaType expectedSchemaType ,
!                              List expectedQNames , int errorType,
!                              SchemaType badSchemaType )
! 
      {
          _errorState++;
  
***************
*** 121,143 ****
              if (_errorListener != null)
              {
                  assert event != null;
  
-                 _errorListener.add(IdentityConstraint.errorForEvent(msg, severity, \
event));  }
          }
-     }
  
-     private void emitFieldError ( Event event, String msg, QName name )
-     {
-         emitFieldError( event, msg + " " + QNameHelper.pretty( name ) );
      }
  
!     private void emitFieldError ( Event event, String msg )
      {
!         emitFieldError(event, msg, XmlError.SEVERITY_ERROR);
      }
  
!     private void emitFieldError ( Event event, String msg, int severity )
      {
          if (_stateStack != null && _stateStack._field != null)
          {
--- 151,193 ----
              if (_errorListener != null)
              {
                  assert event != null;
+                 _errorListener.add(
+                     XmlValidationError.forCursorWithDetails
+                        (
+                            XmlError.forCursor( msg, severity, \
event.getLocationAsCursor()), +                            offendingQName,
+                            expectedSchemaType,
+                            expectedQNames,
+                            errorType,
+                            badSchemaType
+                         )
+ 
+                     );
  
              }
          }
  
      }
  
!     private void emitFieldError ( Event event, String msg,
!                                   QName offendingQName, SchemaType \
                expectedSchemaType ,
!                                   List expectedQNames , int errorType,
!                                   SchemaType badSchemaType )
! 
      {
!         emitFieldError(event, msg, XmlError.SEVERITY_ERROR,
!                        offendingQName , expectedSchemaType,
!                        expectedQNames , errorType,
!                        badSchemaType);
! 
      }
  
!     private void emitFieldError ( Event event, String msg, int severity,
!                                   QName offendingQName, SchemaType \
                expectedSchemaType ,
!                                   List expectedQNames , int errorType,
!                                   SchemaType badSchemaType )
! 
! 
      {
          if (_stateStack != null && _stateStack._field != null)
          {
***************
*** 145,151 ****
                  " in element " + QNameHelper.pretty( _stateStack._field.getName() \
);  }
  
!         Validator.this.emitError( event, msg, severity );
      }
  
      // For XmlEventListener.error
--- 195,205 ----
                  " in element " + QNameHelper.pretty( _stateStack._field.getName() \
);  }
  
!         Validator.this.emitError( event, msg, severity,
!                                   offendingQName , expectedSchemaType,
!                                   expectedQNames , errorType,
!                                   badSchemaType);
! 
      }
  
      // For XmlEventListener.error
***************
*** 218,231 ****
  
              if (state._isNil)
              {
!                 emitFieldError(event,  "Nil element cannot have element content");
                  _eatContent = 1;
                  return;
              }
  
              if (!state.visit( name ))
              {
!                 message = findDetailedErrorBegin(state , name);
                  if (message != null)
                  {
                    emitFieldError(event, message);
--- 272,301 ----
  
              if (state._isNil)
              {
! 
!               //offendingQName = state._field.getName();
!               //expectedSchemaType = state._type;
!               //errorType = XmlValidationError.NIL_ELEMENT;
!               // The expected and the bad schema types are the same because nil \
                elements cannot have element content
!               //badSchemaType = state._type;
! 
!                 emitFieldError
!                     (event,
!                     "Nil element cannot have element content",
!                     state._field.getName(),
!                     state._type,
!                     null,
!                     XmlValidationError.NIL_ELEMENT,
!                     state._type
!                     );
                  _eatContent = 1;
                  return;
              }
  
              if (!state.visit( name ))
              {
!                 findDetailedErrorBegin(event ,state , name);
!                 /*
                  if (message != null)
                  {
                    emitFieldError(event, message);
***************
*** 235,240 ****
--- 305,311 ----
                  {
                    emitFieldError(event, "Element not allowed:", name);
                  }
+                 */
                  _eatContent = 1;
  
                  return;
***************
*** 252,258 ****
                  {
                      // Additional processing may be needed to generate more
                      // descriptive messages
!                     emitFieldError( event, "Element not allowed:", name );
                      _eatContent = 1;
  
                      return;
--- 323,343 ----
                  {
                      // Additional processing may be needed to generate more
                      // descriptive messages
! 
!                     //offendingQName = name;
!                     //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
!                     //badSchemaType = state._type;
! 
!                     emitFieldError
!                         (
!                         event,
!                         "Element not allowed: " + QNameHelper.pretty(name) ,
!                         name,
!                         null,
!                         null,
!                         XmlValidationError.ELEMENT_NOT_ALLOWED,
!                         state._type
!                         );
                      _eatContent = 1;
  
                      return;
***************
*** 273,280 ****
                  {
                      if (wildcardProcess == SchemaParticle.STRICT)
                      {
!                         emitFieldError(
!                             event, "Element not allowed (strict wildcard, and no \
definition found):", name );  }
  
                      _eatContent = 1;
--- 358,378 ----
                  {
                      if (wildcardProcess == SchemaParticle.STRICT)
                      {
!                       //offendingQName = name;
!                       //expectedSchemaType = state._type;
!                       //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
!                       //badSchemaType = state._type;
! 
!                         emitFieldError
!                             (
!                             event,
!                             "Element not allowed (strict wildcard, and no \
                definition found): " +  QNameHelper.pretty(name),
!                             name,
!                             state._type,
!                             null,
!                             XmlValidationError.ELEMENT_NOT_ALLOWED,
!                             state._type
!                             );
                      }
  
                      _eatContent = 1;
***************
*** 296,303 ****
                  {
                      if (((SchemaLocalElement)currentParticle).blockSubstitution())
                      {
!                         emitFieldError(event,
!                             "Element substitution not allowed when group head has \
block='substitution'", name);  _eatContent = 1;
                          return;
                      }
--- 394,415 ----
                  {
                      if (((SchemaLocalElement)currentParticle).blockSubstitution())
                      {
! 
!                       //offendingQName = name;
!                       //expectedSchemaType = state._type;
!                       //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
!                       //badSchemaType = state._type;
! 
!                         emitFieldError
!                             (
!                             event,
!                             "Element substitution not allowed when group head has \
                block='substitution'" + QNameHelper.pretty( name),
!                             name,
!                             state._type,
!                             null,
!                             XmlValidationError.ELEMENT_NOT_ALLOWED,
!                             state._type
!                             );
                          _eatContent = 1;
                          return;
                      }
***************
*** 329,335 ****
  
          if (elementType.isNoType())
          {
!             emitFieldError(event, "Invalid type.");
              _eatContent = 1;
          }
  
--- 441,461 ----
  
          if (elementType.isNoType())
          {
!           //offendingQName = event.getName();
!           //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!             emitFieldError
!                 (
!                 event,
!                 "Invalid type.",
!                 event.getName(),
!                 null,
!                 null,
!                 XmlValidationError.ELEMENT_TYPE_INVALID,
!                 null
!                 );
! 
! 
              _eatContent = 1;
          }
  
***************
*** 371,378 ****
  
              if (originalErrorState != _errorState)
              {
!                 emitFieldError(
!                     event, "Invalid xsi:type qname: '" + value + "'" );
  
                  _eatContent = 1;
  
--- 497,519 ----
  
              if (originalErrorState != _errorState)
              {
! 
!               //errorAttributes._offendingQName = event.getName();
!               // not sure how to extract this one
!               //expectedSchemaType = xsiType;
!               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!               //badSchemaType = state._type;
! 
!                 emitFieldError
!                     (
!                     event,
!                     "Invalid xsi:type qname: '" + value + "'",
!                     event.getName(),
!                     xsiType,
!                     null,
!                     XmlValidationError.ELEMENT_TYPE_INVALID,
!                     state._type
!                     );
  
                  _eatContent = 1;
  
***************
*** 380,386 ****
              }
              else if (xsiType == null)
              {
!                 emitError(event,  "Could not find xsi:type: '" + value + "'");
  
                  _eatContent = 1;
  
--- 521,538 ----
              }
              else if (xsiType == null)
              {
! 
!               //offendingQName = event.getName();
!               // NOT SURE errorAttributes._expectedSchemaType = xsiType;
!               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!                 emitError(event,  "Could not find xsi:type: '" + value + "'",
!                           event.getName(),
!                           null,
!                           null,
!                           XmlValidationError.ELEMENT_TYPE_INVALID,
!                           null
!                           );
  
                  _eatContent = 1;
  
***************
*** 392,401 ****
          {
              if (!elementType.isAssignableFrom(xsiType))
              {
!                 emitFieldError(
                      event,
                      "Type '" + xsiType +
!                         "' is not derived from '" + elementType + "'" );
  
                  _eatContent = 1;
  
--- 544,567 ----
          {
              if (!elementType.isAssignableFrom(xsiType))
              {
! 
!               //offendingQName = event.getName();
!               //expectedSchemaType = elementType;
!               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!               //badSchemaType = state._type
! 
! 
!                 emitFieldError
!                     (
                      event,
                      "Type '" + xsiType +
!                         "' is not derived from '" + elementType + "'",
!                     event.getName(),
!                     elementType,
!                     null,
!                     XmlValidationError.ELEMENT_TYPE_INVALID,
!                     state._type
!                     );
  
                  _eatContent = 1;
  
***************
*** 409,419 ****
                  {
                      if (t.getDerivationType() == SchemaType.DT_EXTENSION)
                      {
!                         emitFieldError(
                              event,
                              "Extension type: '" + xsiType +
                                  "' may not be substituted for: '" +
!                                     elementType + "'" );
  
                          _eatContent = 1;
  
--- 575,598 ----
                  {
                      if (t.getDerivationType() == SchemaType.DT_EXTENSION)
                      {
! 
!                       //offendingQName = event.getName();
!                       //expectedSchemaType = elementType;
!                       //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!                       //badSchemaType = state._type;
! 
!                         emitFieldError
!                             (
                              event,
                              "Extension type: '" + xsiType +
                                  "' may not be substituted for: '" +
!                                     elementType + "'",
!                             event.getName(),
!                             elementType,
!                             null,
!                             XmlValidationError.ELEMENT_TYPE_INVALID,
!                             state._type
!                             );
  
                          _eatContent = 1;
  
***************
*** 429,439 ****
                  {
                      if (t.getDerivationType() == SchemaType.DT_RESTRICTION)
                      {
!                         emitFieldError(
                              event,
                              "Restriction type: '" + xsiType +
                                  "' may not be substituted for: '" +
!                                     elementType + "'" );
  
                          _eatContent = 1;
  
--- 608,630 ----
                  {
                      if (t.getDerivationType() == SchemaType.DT_RESTRICTION)
                      {
!                       //offendingQName = event.getName();
!                       //expectedSchemaType = elementType;
!                       //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!                       //badSchemaType = state._type;
! 
!                         emitFieldError
!                             (
                              event,
                              "Restriction type: '" + xsiType +
                                  "' may not be substituted for: '" +
!                                     elementType + "'",
!                             event.getName(),
!                             elementType,
!                             null,
!                             XmlValidationError.ELEMENT_TYPE_INVALID,
!                             state._type
!                             );
  
                          _eatContent = 1;
  
***************
*** 455,465 ****
                          if ((t.getDerivationType() == SchemaType.DT_RESTRICTION && \
                sle.blockRestriction()) ||
                              (t.getDerivationType() == SchemaType.DT_EXTENSION && \
sle.blockExtension()))  {
                              emitError(
                                  event,
                                  "Derived type: '" + xsiType +
                                      "' may not be substituted for element '" +
!                                     QNameHelper.pretty(sle.getName()) + "'" );
  
                              _eatContent = 1;
  
--- 646,670 ----
                          if ((t.getDerivationType() == SchemaType.DT_RESTRICTION && \
                sle.blockRestriction()) ||
                              (t.getDerivationType() == SchemaType.DT_EXTENSION && \
sle.blockExtension()))  {
+ 
+                           //offendingQName = sle.getName();
+                           //need to find a way to get the right type
+                           //errorAttributes._expectedSchemaType = ;
+                           //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
+ 
+ 
+ 
                              emitError(
                                  event,
                                  "Derived type: '" + xsiType +
                                      "' may not be substituted for element '" +
!                                     QNameHelper.pretty(sle.getName()) + "'" ,
!                                     sle.getName(),
!                                     null,
!                                     null,
!                                     XmlValidationError.ELEMENT_TYPE_INVALID,
!                                     null
!                                     );
  
                              _eatContent = 1;
  
***************
*** 480,487 ****
  
              if (sle.isAbstract())
              {
!                 emitError(event,  "Element '" + QNameHelper.pretty(sle.getName()) +
!                     "' is abstract and cannot be used in an instance.");
                  _eatContent = 1;
                  return;
              }
--- 685,705 ----
  
              if (sle.isAbstract())
              {
! 
!               //offendingQName = sle.getName();
!               //need to find a way to get the right type
!               //errorAttributes._expectedSchemaType = ;
!               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!                 emitError(event,
!                           "Element '" + QNameHelper.pretty(sle.getName()) +
!                           "' is abstract and cannot be used in an instance.",
!                           sle.getName(),
!                           null,
!                           null,
!                           XmlValidationError.ELEMENT_TYPE_INVALID,
!                           null
!                           );
                  _eatContent = 1;
                  return;
              }
***************
*** 489,498 ****
  
          if (elementType != null && elementType.isAbstract())
          {
!             emitFieldError(
                  event,
                  "Abstract type: " + elementType +
!                     " cannot be used in an instance" );
  
              _eatContent = 1;
  
--- 707,729 ----
  
          if (elementType != null && elementType.isAbstract())
          {
! 
!           //offendingQName = event.getName();
!           //expectedSchemaType = elementType;
!           //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!           //badSchemaType = state._type;
! 
!             emitFieldError
!                 (
                  event,
                  "Abstract type: " + elementType +
!                     " cannot be used in an instance",
!                 event.getName(),
!                 elementType,
!                 null,
!                 XmlValidationError.ELEMENT_TYPE_INVALID,
!                 state._type
!                 );
  
              _eatContent = 1;
  
***************
*** 512,518 ****
          // note in schema spec 3.3.4, you're not even allowed to say \
xsi:nil="false" if you're not nillable!  if (hasNil && !elementField.isNillable())
          {
!             emitFieldError(event,  "Element has xsi:nil attribute but is not \
nillable");  
              _eatContent = 1;
              return;
--- 743,764 ----
          // note in schema spec 3.3.4, you're not even allowed to say \
xsi:nil="false" if you're not nillable!  if (hasNil && !elementField.isNillable())
          {
! 
!           //_offendingQName = elementField.getName();
!           //_expectedSchemaType = elementField.getType();
!           //_errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!           //_badSchemaType = state._type;
! 
!             emitFieldError
!                 (
!                 event,
!                 "Element has xsi:nil attribute but is not nillable",
!                 elementField.getName(),
!                 elementField.getType(),
!                 null,
!                 XmlValidationError.ELEMENT_TYPE_INVALID,
!                 state._type
!                 );
  
              _eatContent = 1;
              return;
***************
*** 542,550 ****
  
          if (state._attrs.contains( attrName ))
          {
!             emitFieldError(
                  event,
!                 "Duplicate attribute: " + QNameHelper.pretty( attrName ) );
  
              return;
          }
--- 788,810 ----
  
          if (state._attrs.contains( attrName ))
          {
!           //offendingQName =attrName;
!           //need additional logic to determine the expectedSchemaType
!           //errorAttributes._expectedSchemaType = ;
!           //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!           //badSchemaType = state._type;
! 
! 
!             emitFieldError
!                 (
                  event,
!                 "Duplicate attribute: " + QNameHelper.pretty( attrName ),
!                 attrName,
!                 null,
!                 null,
!                 XmlValidationError.INCORRECT_ATTRIBUTE,
!                 state._type
!                 );
  
              return;
          }
***************
*** 553,559 ****
  
          if (!state._canHaveAttrs)
          {
!             emitFieldError( event, "Can't have attributes" );
              return;
          }
  
--- 813,834 ----
  
          if (!state._canHaveAttrs)
          {
!           //offendingQName =attrName;
!           //need additional logic to determine the expectedSchemaType
!           //errorAttributes._expectedSchemaType = ;
!           //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!           //badSchemaType = state._type;
! 
!             emitFieldError
!                 (
!                 event,
!                 "Can't have attributes",
!                 attrName,
!                 null,
!                 null,
!                 XmlValidationError.INCORRECT_ATTRIBUTE,
!                 state._type
!                 );
              return;
          }
  
***************
*** 568,577 ****
  
              if (attrSchema.getUse() == SchemaLocalAttribute.PROHIBITED)
              {
!                 emitFieldError(
                      event,
                      "Attribute is prohibited: "
!                         + QNameHelper.pretty( attrName ) );
  
                  return;
              }
--- 843,867 ----
  
              if (attrSchema.getUse() == SchemaLocalAttribute.PROHIBITED)
              {
!               //offendingQName =attrName;
!               //need additional logic to determine the expectedSchemaType
!               //errorAttributes._expectedSchemaType = ;
!               //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!               //badSchemaType = state._type;
! 
! 
!                 emitFieldError
!                     (
                      event,
                      "Attribute is prohibited: "
!                         + QNameHelper.pretty( attrName ),
!                     attrName,
!                     null,
!                     null,
!                     XmlValidationError.INCORRECT_ATTRIBUTE,
!                     state._type
!                     );
! 
  
                  return;
              }
***************
*** 590,599 ****
  
          if (wildcardProcess == SchemaAttributeModel.NONE)
          {
!             emitFieldError(
                  event,
                  "Attribute not allowed (no wildcards allowed): "
!                     + QNameHelper.pretty( attrName ) );
  
              return;
          }
--- 880,902 ----
  
          if (wildcardProcess == SchemaAttributeModel.NONE)
          {
! 
!           //offendingQName =attrName;
!           //need additional logic to determine the expectedSchemaType
!           //errorAttributes._expectedSchemaType = ;
!           //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!           //badSchemaType = state._type;
!             emitFieldError
!                 (
                  event,
                  "Attribute not allowed (no wildcards allowed): "
!                     + QNameHelper.pretty( attrName ),
!                 attrName,
!                 null,
!                 null,
!                 XmlValidationError.INCORRECT_ATTRIBUTE,
!                 state._type
!                 );
  
              return;
          }
***************
*** 602,610 ****
  
          if (!attrWildcardSet.contains( attrName ))
          {
              emitFieldError(
                  event,
!                 "Attribute not allowed: " + QNameHelper.pretty( attrName ) );
  
              return;
          }
--- 905,926 ----
  
          if (!attrWildcardSet.contains( attrName ))
          {
+ 
+           //offendingQName =attrName;
+           //need additional logic to determine the expectedSchemaType
+           //errorAttributes._expectedSchemaType = ;
+           //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
+           //badSchemaType = state._type;
+ 
              emitFieldError(
                  event,
!                 "Attribute not allowed: " + QNameHelper.pretty( attrName ),
!                 attrName,
!                 null,
!                 null,
!                 XmlValidationError.INCORRECT_ATTRIBUTE,
!                 state._type
!                 );
  
              return;
          }
***************
*** 623,631 ****
  
              assert wildcardProcess == SchemaAttributeModel.STRICT;
  
!             emitFieldError(
                  event,
!                 "Attribute not allowed (strict wildcard, and no definition found): \
" + QNameHelper.pretty( attrName ) );  
              return;
          }
--- 939,961 ----
  
              assert wildcardProcess == SchemaAttributeModel.STRICT;
  
!             //offendingQName =attrName;
!             //need additional logic to determine the expectedSchemaType
!             //errorAttributes._expectedSchemaType = ;
!             //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!             //badSchemaType = state._type;
! 
!             emitFieldError
!                 (
                  event,
!                 "Attribute not allowed (strict wildcard, and no definition found): \
                " + QNameHelper.pretty( attrName ),
!                 attrName,
!                 null,
!                 null,
!                 XmlValidationError.INCORRECT_ATTRIBUTE,
!                 state._type
!                 );
! 
  
              return;
          }
***************
*** 654,661 ****
                  {
                      if (sla.getUse() == SchemaLocalAttribute.REQUIRED)
                      {
!                         emitFieldError(
!                             event, "Expected attribute: ", sla.getName() );
                      }
                      else if (sla.isDefault() || sla.isFixed())
                      {
--- 984,1004 ----
                  {
                      if (sla.getUse() == SchemaLocalAttribute.REQUIRED)
                      {
! 
!                       //offendingQName = sla.getName();
!                       //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
!                       //badSchemaType = state._type;
! 
!                         emitFieldError
!                             (
!                             event,
!                             "Expected attribute: " + QNameHelper.pretty \
                (sla.getName()),
!                             sla.getName(),
!                             null,
!                             null,
!                             XmlValidationError.INCORRECT_ATTRIBUTE,
!                             state._type
!                             );
                      }
                      else if (sla.isDefault() || sla.isFixed())
                      {
***************
*** 701,716 ****
              if (!state.end())
              {
  
!                 message = findDetailedErrorEnd(state);
  
-                 if (message != null)
-                 {
-                   emitFieldError(event, message);
-                 }
-                 else
-                 {
-                   emitFieldError(event, "Expected element(s)");
-                 }
              }
  
              // This end event has no text, use this fact to pass no text to
--- 1044,1052 ----
              if (!state.end())
              {
  
!                 findDetailedErrorEnd(event,state);
! 
  
              }
  
              // This end event has no text, use this fact to pass no text to
***************
*** 730,736 ****
          State state = topState();
  
          if (state._isNil)
!             emitFieldError(event, "Nil element cannot have simple content");
          else
              handleText( event, false, state._field );
  
--- 1066,1088 ----
          State state = topState();
  
          if (state._isNil)
!         {
!           //offendingQName =state._field.getName();
!           //expectedSchemaType = state._type ;
!           //errorType = XmlValidationError.NIL_ELEMENT;
!           //badSchemaType = state._type;
! 
!           emitFieldError
!               (
!               event,
!               "Nil element cannot have simple content",
!               state._field.getName(),
!               state._type,
!               null,
!               XmlValidationError.NIL_ELEMENT,
!               state._type
!               );
!         }
          else
              handleText( event, false, state._field );
  
***************
*** 767,787 ****
              if (field instanceof SchemaLocalElement)
              {
                  SchemaLocalElement e = (SchemaLocalElement)field;
!                 emitError(event, "Element: '" + QNameHelper.pretty(e.getName()) + \
"' cannot have mixed content.");  }
              else
!                 emitError( event, "Can't have mixed content" );
          }
  
          if (!emptyContent)
              state._sawText = true;
      }
  
!     private String findDetailedErrorBegin(State state, QName qName)
      {
          String message = null;
          SchemaProperty[] eltProperties = state._type.getElementProperties();
- 
          for (int ii = 0; ii < eltProperties.length; ii++)
          {
              //Get the element from the schema
--- 1119,1162 ----
              if (field instanceof SchemaLocalElement)
              {
                  SchemaLocalElement e = (SchemaLocalElement)field;
! 
!                 //offendingQName = e.getName();
!                 //expectedSchemaType = field.getType();
!                 //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!                 emitError(event,
!                           "Element: '" + QNameHelper.pretty(e.getName()) + "' \
                cannot have mixed content.",
!                           e.getName(),
!                           field.getType(),
!                           null,
!                           XmlValidationError.ELEMENT_TYPE_INVALID,
!                           null);
              }
              else
!             {
!               //offendingQName = not sure how to get this(event.getName()??);
!               //expectedSchemaType = state._type;
!               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
!               emitError(event,
!                         "Can't have mixed content",
!                         event.getName(),
!                         state._type,
!                         null,
!                         XmlValidationError.ELEMENT_TYPE_INVALID,
!                         null
!                         );
! 
!             }
          }
  
          if (!emptyContent)
              state._sawText = true;
      }
  
!     private void findDetailedErrorBegin(Event event, State state, QName qName)
      {
          String message = null;
          SchemaProperty[] eltProperties = state._type.getElementProperties();
          for (int ii = 0; ii < eltProperties.length; ii++)
          {
              //Get the element from the schema
***************
*** 791,803 ****
              if (state.test(sProp.getName()))
              {
                  message = "Expected element " + QNameHelper.pretty(sProp.getName()) \
+ " instead of " + QNameHelper.pretty(qName) + " here";  break;
              }
          }
!         return message;
      }
  
!     private String findDetailedErrorEnd(State state)
      {
          SchemaProperty[] eltProperties  = state._type.getElementProperties();
          String message = null;
--- 1166,1218 ----
              if (state.test(sProp.getName()))
              {
                  message = "Expected element " + QNameHelper.pretty(sProp.getName()) \
+ " instead of " + QNameHelper.pretty(qName) + " here"; +                 ArrayList \
expectedNames = new ArrayList(); +                 \
expectedNames.add(sProp.getName()); + 
+ 
+                 //offendingQName = qName;
+                 //expectedSchemaType=sProp.getType();
+                 //errorType = XmlValidationError.INCORRECT_ELEMENT;
+                 //badSchemaType = state._type;
+                 //expectedQNames=sProp.getName();
+ 
+                 emitFieldError
+                     (
+                     event,
+                     message,
+                     qName,
+                     sProp.getType(),
+                     expectedNames,
+                     XmlValidationError.INCORRECT_ELEMENT,
+                     state._type
+                     );
+ 
+ 
                  break;
              }
          }
!         if (message == null)
!         {
!           //offendingQName = qName;
!           //severity =XmlError.SEVERITY_ERROR;
!           //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
!           //badSchemaType = state._type;
! 
!           emitFieldError
!               (
!               event,
!               "Element not allowed: " + QNameHelper.pretty( qName),
!               qName,
!               null,
!               null,
!               XmlValidationError.INCORRECT_ELEMENT,
!               state._type
!               );
!         }
! 
      }
  
!     private void findDetailedErrorEnd(Event event, State state)
      {
          SchemaProperty[] eltProperties  = state._type.getElementProperties();
          String message = null;
***************
*** 812,821 ****
              {
                  message = "Expected element " + QNameHelper.pretty(sProp.getName()) \
+  " at the end of the content";
                  break;
              }
          }
!         return message;
      }
  
  
--- 1227,1271 ----
              {
                  message = "Expected element " + QNameHelper.pretty(sProp.getName()) \
+  " at the end of the content";
+ 
+                 ArrayList expectedNames = new ArrayList();
+                 expectedNames.add(sProp.getName());
+ 
+                 //expectedSchemaType=sProp.getType();
+                 //errorType = XmlValidationError.INCORRECT_ELEMENT;
+                 //badSchemaType = state._type;
+                 //expectedQNames=(sProp.getName());
+ 
+                 emitFieldError
+                     (event,
+                     message,
+                     null,
+                     sProp.getType(),
+                     expectedNames,
+                     XmlValidationError.INCORRECT_ELEMENT,
+                     state._type
+                     );
+ 
                  break;
              }
          }
! 
!         if (message == null)
!         {
!           //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
!           //badSchemaType = state._type;
!           emitFieldError
!               (
!               event,
!               "Expected element(s)",
!               null,
!               null,
!               null,
!               XmlValidationError.ELEMENT_NOT_ALLOWED,
!               state._type);
!         }
! 
! 
      }
  
  
***************
*** 981,987 ****
  
          if (type.isNoType())
          {
!             emitError(event, "Invalid type.");
              return null;
          }
  
--- 1431,1449 ----
  
          if (type.isNoType())
          {
!           //offendingQName = field.getName();
!           //expectedSchemaType = type;
!           //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!             emitError(
!             event,
!             "Invalid type.",
!             field.getName(),
!             type,
!             null,
!             XmlValidationError.ELEMENT_TYPE_INVALID,
!             null
!             );
              return null;
          }
  
***************
*** 1003,1013 ****
          {
              if (XmlQName.type.isAssignableFrom(type))
              {
                  emitError(
                      event,
                      "Default QName values are unsupported for " +
                          QNameHelper.readable(type) + " - ignoring.",
!                     XmlError.SEVERITY_INFO);
  
                  return null;
              }
--- 1465,1484 ----
          {
              if (XmlQName.type.isAssignableFrom(type))
              {
+               //offendingQName = field.getName();
+               //expectedSchemaType = type;
+               //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
+ 
                  emitError(
                      event,
                      "Default QName values are unsupported for " +
                          QNameHelper.readable(type) + " - ignoring.",
!                     XmlError.SEVERITY_INFO,
!                     field.getName(),
!                     type,
!                     null,
!                     XmlValidationError.ELEMENT_TYPE_INVALID,
!                     null);
  
                  return null;
              }
***************
*** 1043,1051 ****
              {
                  // BUGBUG - make this more verbose
  
!                 emitError(
                      event,
!                     "Value not equal to fixed value. " + value );
  
                  return null;
              }
--- 1514,1533 ----
              {
                  // BUGBUG - make this more verbose
  
!                 //offendingQName = field.getName();
!                 //expectedSchemaType = field.getType();
!                 //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
! 
!                 emitError
!                     (
                      event,
!                     "Value not equal to fixed value. " + value,
!                     field.getName(),
!                     field.getType(),
!                     null,
!                     XmlValidationError.ELEMENT_TYPE_INVALID,
!                     null
!                     );
  
                  return null;
              }
***************
*** 1224,1232 ****
  
          if (!type.matchPatternFacet( value ))
          {
!             emitError(
                  event,
!                 "List '" + value + "' does not match pattern for " + \
QNameHelper.readable(type) );  }
  
          String[] items = XmlListImpl.split_list(value);
--- 1706,1725 ----
  
          if (!type.matchPatternFacet( value ))
          {
!           //offending Qname not valid
!           //expectedSchemaType = type;
!           //errorType = XmlValidationError.LIST_INVALID;
! 
!             emitError
!                 (
                  event,
!                 "List '" + value + "' does not match pattern for " + \
                QNameHelper.readable(type),
!                 null,
!                 type,
!                 null,
!                 XmlValidationError.LIST_INVALID,
!                 null
!                 );
          }
  
          String[] items = XmlListImpl.split_list(value);
***************
*** 1239,1248 ****
          {
              if ((i = ((SimpleValue)o).getIntValue()) != items.length)
              {
!                 emitError(
                      event,
                      "List (" + value + ") does not have " + i +
!                         " items per length facet for " + \
QNameHelper.readable(type));  }
          }
  
--- 1732,1752 ----
          {
              if ((i = ((SimpleValue)o).getIntValue()) != items.length)
              {
!               //offending Qname not valid
!               //expectedSchemaType = type;
!               //errorType = XmlValidationError.LIST_INVALID;
! 
!                 emitError
!                     (
                      event,
                      "List (" + value + ") does not have " + i +
!                         " items per length facet for " + \
                QNameHelper.readable(type),
!                     null,
!                     type,
!                     null,
!                     XmlValidationError.LIST_INVALID,
!                     null
!                     );
              }
          }
  
***************
*** 1250,1259 ****
          {
              if ((i = ((SimpleValue)o).getIntValue()) > items.length)
              {
!                 emitError(
                      event,
                      "List (" + value + ") has only " + items.length +
!                         " items, fewer than min length facet (" + i + ") for " + \
QNameHelper.readable(type) );  }
          }
  
--- 1754,1775 ----
          {
              if ((i = ((SimpleValue)o).getIntValue()) > items.length)
              {
!               //offending Qname not valid
!               //expectedSchemaType = type;
!               //errorType = XmlValidationError.LIST_INVALID;
! 
!                 emitError
!                     (
                      event,
                      "List (" + value + ") has only " + items.length +
!                         " items, fewer than min length facet (" + i + ") for " + \
                QNameHelper.readable(type),
!                     null,
!                     type,
!                     null,
!                     XmlValidationError.LIST_INVALID,
!                     null
!                     );
! 
              }
          }
  
***************
*** 1261,1270 ****
          {
              if ((i = ((SimpleValue)o).getIntValue()) < items.length)
              {
!                 emitError(
!                     event,
!                     "List (" + value + ") has " + items.length +
!                         " items, more than max length facet (" + i + ") for " + \
QNameHelper.readable(type) );  }
          }
  
--- 1777,1799 ----
          {
              if ((i = ((SimpleValue)o).getIntValue()) < items.length)
              {
! 
!               //offending Qname not valid
!               //expectedSchemaType = type;
!               //errorType = XmlValidationError.LIST_INVALID;
! 
!                 emitError
!                 (
!                 event,
!                 "List (" + value + ") has " + items.length +
!                     " items, more than max length facet (" + i + ") for " + \
                QNameHelper.readable(type),
!                 null,
!                 type,
!                 null,
!                 XmlValidationError.LIST_INVALID,
!                 null
!                 );
! 
              }
          }
  
***************
*** 1297,1306 ****
                  }
                  catch (XmlValueOutOfRangeException e)
                  {
!                     emitError(
!                         event,
!                         "List value (" + value +
!                             ") is not a valid enumeration value for " + \
QNameHelper.readable(type));  }
                  finally
                  {
--- 1826,1845 ----
                  }
                  catch (XmlValueOutOfRangeException e)
                  {
!                   //offending Qname not valid ??
!                   //expectedSchemaType = type;
!                   //errorType = XmlValidationError.LIST_INVALID;
!                     emitError
!                     (
!                     event,
!                     "List value (" + value +
!                         ") is not a valid enumeration value for " + \
                QNameHelper.readable(type),
!                     null,
!                     type,
!                     null,
!                     XmlValidationError.LIST_INVALID,
!                     null
!                     );
                  }
                  finally
                  {
***************
*** 1318,1326 ****
  
          if (!type.matchPatternFacet( value ))
          {
!             emitError(
!                 event,
!                 "Union '" + value + "' does not match pattern for " + \
QNameHelper.readable(type));  }
  
          int currentWsr = SchemaType.WS_PRESERVE;
--- 1857,1877 ----
  
          if (!type.matchPatternFacet( value ))
          {
!           //offending Qname not valid ??
!           //expectedSchemaType = type;
!           //errorType = XmlValidationError.UNION_INVALID;
! 
!             emitError
!             (
!             event,
!             "Union '" + value + "' does not match pattern for " + \
                QNameHelper.readable(type),
!             null,
!             type,
!             null,
!             XmlValidationError.UNION_INVALID,
!             null
!             );
! 
          }
  
          int currentWsr = SchemaType.WS_PRESERVE;
***************
*** 1368,1376 ****
  
          if (i >= types.length)
          {
!             emitError(
                  event,
!                 "Union '" + value + "' does not match any members of " + \
QNameHelper.readable(type) );  }
          else
          {
--- 1919,1940 ----
  
          if (i >= types.length)
          {
! 
!           //offending Qname not valid ??
!           //expectedSchemaType = type;
!           //errorType = XmlValidationError.UNION_INVALID;
! 
!             emitError
!                 (
                  event,
!                 "Union '" + value + "' does not match any members of " + \
                QNameHelper.readable(type),
!                 null,
!                 type,
!                 null,
!                 XmlValidationError.UNION_INVALID,
!                 null
!                 );
! 
          }
          else
          {
***************
*** 1394,1412 ****
  
                      if (i >= unionEnumvals.length)
                      {
!                         emitError(
                              event,
                              "Union '" + value +
!                                 "' is not a valid enumeration value for " + \
QNameHelper.readable(type) );  }
                  }
                  catch (XmlValueOutOfRangeException e)
                  {
                      // actually, the current union code always ends up here when \
                invalid
!                     emitError(
                          event,
                          "Union '" + value +
!                             "' is not a valid enumeration value for " + \
QNameHelper.readable(type) );  }
                  finally
                  {
--- 1958,2004 ----
  
                      if (i >= unionEnumvals.length)
                      {
! 
!                       //offending Qname not valid ??
!                       //expectedSchemaType = type;
!                       //errorType = XmlValidationError.UNION_INVALID;
! 
!                         emitError
!                             (
                              event,
                              "Union '" + value +
!                                 "' is not a valid enumeration value for " + \
                QNameHelper.readable(type),
!                             null,
!                             type,
!                             null,
!                             XmlValidationError.UNION_INVALID,
!                             null
!                             );
! 
                      }
                  }
                  catch (XmlValueOutOfRangeException e)
                  {
                      // actually, the current union code always ends up here when \
                invalid
! 
!                     //offending Qname not valid ??
!                     //expectedSchemaType = type;
!                     //errorType = XmlValidationError.UNION_INVALID;
! 
!                     emitError
!                         (
                          event,
                          "Union '" + value +
!                             "' is not a valid enumeration value for " + \
                QNameHelper.readable(type),
!                         null,
!                         type,
!                         null,
!                         XmlValidationError.UNION_INVALID,
!                         null
!                         );
! 
! 
! 
                  }
                  finally
                  {
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/impl/values
cvs server: Diffing src/typeimpl/org/apache/xmlbeans/soap
cvs server: Diffing src/typestore
cvs server: Diffing src/typestore/org
cvs server: Diffing src/typestore/org/apache
cvs server: Diffing src/typestore/org/apache/xmlbeans
cvs server: Diffing src/typestore/org/apache/xmlbeans/impl
cvs server: Diffing src/typestore/org/apache/xmlbeans/impl/values
cvs server: Diffing src/xmlcomp
cvs server: Diffing src/xmlcomp/org
cvs server: Diffing src/xmlcomp/org/apache
cvs server: Diffing src/xmlcomp/org/apache/xmlbeans
cvs server: Diffing src/xmlcomp/org/apache/xmlbeans/impl
cvs server: Diffing src/xmlcomp/org/apache/xmlbeans/impl/tool
Index: src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
===================================================================
RCS file: /home/cvspublic/xml-xmlbeans/v2/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java,v
 retrieving revision 1.2
diff -c -r1.2 InstanceValidator.java
*** src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java	12 Feb 2004 \
                20:06:25 -0000	1.2
--- src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java	23 Mar 2004 \
                06:52:09 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ 
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
***************
*** 13,18 ****
--- 14,20 ----
   *  limitations under the License.
   */
  
+ 
  package org.apache.xmlbeans.impl.tool;
  
  import org.apache.xmlbeans.XmlBeans;
***************
*** 50,66 ****
              System.out.println("    -license prints license information");
              return;
          }
!         
          boolean dl = (cl.getOpt("dl") != null);
          boolean nopvr = (cl.getOpt("nopvr") != null);
          boolean noupa = (cl.getOpt("noupa") != null);
!         
          File[] schemaFiles = cl.filesEndingWith(".xsd");
          File[] instanceFiles = cl.filesEndingWith(".xml");
!         
          List sdocs = new ArrayList();
!         
!         
          for (int i = 0; i < schemaFiles.length; i++)
          {
              try
--- 52,68 ----
              System.out.println("    -license prints license information");
              return;
          }
! 
          boolean dl = (cl.getOpt("dl") != null);
          boolean nopvr = (cl.getOpt("nopvr") != null);
          boolean noupa = (cl.getOpt("noupa") != null);
! 
          File[] schemaFiles = cl.filesEndingWith(".xsd");
          File[] instanceFiles = cl.filesEndingWith(".xml");
! 
          List sdocs = new ArrayList();
! 
!         System.out.println("At the begining of the validate tool ");
          for (int i = 0; i < schemaFiles.length; i++)
          {
              try
***************
*** 87,93 ****
              schemaOptions.setCompileNoPvrRule();
          if (noupa)
              schemaOptions.setCompileNoUpaRule();
!         
          try
          {
              sLoader = XmlBeans.loadXsd(schemas, schemaOptions);
--- 89,95 ----
              schemaOptions.setCompileNoPvrRule();
          if (noupa)
              schemaOptions.setCompileNoUpaRule();
! 
          try
          {
              sLoader = XmlBeans.loadXsd(schemas, schemaOptions);
***************
*** 98,117 ****
              {
                  e.printStackTrace(System.err);
              }
-             System.out.println("Schema invalid");
              for (Iterator i = compErrors.iterator(); i.hasNext(); )
                  System.out.println(i.next());
              return;
          }
!         
          for (int i = 0; i < instanceFiles.length; i++)
          {
              XmlObject xobj;
!             
              try
              {
                  xobj =
                      sLoader.parse( instanceFiles[i], null, (new \
XmlOptions()).setLoadLineNumbers() );  }
              catch (Exception e)
              {
--- 100,121 ----
              {
                  e.printStackTrace(System.err);
              }
              for (Iterator i = compErrors.iterator(); i.hasNext(); )
                  System.out.println(i.next());
              return;
          }
!         System.out.println("Schema has been loaded ");
! 
          for (int i = 0; i < instanceFiles.length; i++)
          {
              XmlObject xobj;
! 
              try
              {
+ 
                  xobj =
                      sLoader.parse( instanceFiles[i], null, (new \
XmlOptions()).setLoadLineNumbers() ); + 
              }
              catch (Exception e)
              {
***************
*** 119,124 ****
--- 123,130 ----
                  e.printStackTrace(System.err);
                  continue;
              }
+ 
+             System.out.println("Instance has been paresed against schema ");
  
              Collection errors = new ArrayList();
  
cvs server: Diffing src/xmlconfig
cvs server: Diffing src/xmlconfig/org
cvs server: Diffing src/xmlconfig/org/apache
cvs server: Diffing src/xmlconfig/org/apache/xmlbeans
cvs server: Diffing src/xmlconfig/org/apache/xmlbeans/impl
cvs server: Diffing src/xmlconfig/org/apache/xmlbeans/impl/config
cvs server: Diffing src/xmlinputstream
cvs server: Diffing src/xmlinputstream/org
cvs server: Diffing src/xmlinputstream/org/apache
cvs server: Diffing src/xmlinputstream/org/apache/xmlbeans
cvs server: Diffing src/xmlinputstream/org/apache/xmlbeans/xml
cvs server: Diffing src/xmlinputstream/org/apache/xmlbeans/xml/stream
cvs server: Diffing src/xmlinputstream/org/apache/xmlbeans/xml/stream/events
cvs server: Diffing src/xmlinputstream/org/apache/xmlbeans/xml/stream/utils
cvs server: Diffing src/xmlpublic
cvs server: Diffing src/xmlpublic/javax
cvs server: Diffing src/xmlpublic/javax/xml
cvs server: Diffing src/xmlpublic/javax/xml/namespace
cvs server: Diffing src/xmlpublic/org
cvs server: Diffing src/xmlpublic/org/apache
cvs server: Diffing src/xmlpublic/org/apache/xmlbeans
cvs server: Diffing src/xmlschema
cvs server: Diffing src/xmlschema/schema
cvs server: Diffing src/xmlstore
cvs server: Diffing src/xmlstore/org
cvs server: Diffing src/xmlstore/org/apache
cvs server: Diffing src/xmlstore/org/apache/xmlbeans
cvs server: Diffing src/xmlstore/org/apache/xmlbeans/impl
cvs server: Diffing src/xmlstore/org/apache/xmlbeans/impl/store
cvs server: Diffing src/xpath
cvs server: Diffing src/xpath/org
cvs server: Diffing src/xpath/org/apache
cvs server: Diffing src/xpath/org/apache/xmlbeans
cvs server: Diffing src/xpath/org/apache/xmlbeans/impl
cvs server: Diffing src/xpath/org/apache/xmlbeans/impl/xpath
cvs server: Diffing src/xpath/org/apache/xmlbeans/impl/xpath/jaxen
cvs server: Diffing src/xsdschema
cvs server: Diffing src/xsdschema/schema
cvs server: Diffing src/zipcompare
cvs server: Diffing src/zipcompare/zipcompare
cvs server: Diffing test
cvs server: Diffing test/cases
cvs server: Diffing test/cases/enumtest
cvs server: Diffing test/cases/marshal
cvs server: Diffing test/cases/marshal/com
cvs server: Diffing test/cases/marshal/com/mytest
cvs server: Diffing test/cases/nameworld
cvs server: Diffing test/cases/richparser
cvs server: Diffing test/cases/schema
cvs server: Diffing test/cases/schema/XmlSignature
cvs server: Diffing test/cases/schema/appview
cvs server: Diffing test/cases/schema/cyclone
cvs server: Diffing test/cases/schema/dynamic
cvs server: Diffing test/cases/schema/ims
cvs server: Diffing test/cases/schema/j2ee
cvs server: Diffing test/cases/schema/pricequote
cvs server: Diffing test/cases/schema/ra
cvs server: Diffing test/cases/schema/s4s
cvs server: Diffing test/cases/schema/simple
cvs server: Diffing test/cases/schema/simple/javasrc
cvs server: Diffing test/cases/schema/typesonly
cvs server: Diffing test/cases/schema/wli
cvs server: Diffing test/cases/store
cvs server: Diffing test/cases/xmlcatalog
cvs server: Diffing test/cases/xpath
cvs server: Diffing test/cases/xpath/expected
cvs server: Diffing test/src
cvs server: Diffing test/src/drt
cvs server: Diffing test/src/drt/drtcases
cvs server: Diffing test/src/easypo
cvs server: Diffing test/src/easypouse
cvs server: Diffing test/src/easypouse/com
cvs server: Diffing test/src/easypouse/com/bea
cvs server: Diffing test/src/easypouse/com/bea/test
cvs server: Diffing test/src/enumtest
cvs server: Diffing test/src/ericschema
cvs server: Diffing test/src/erictest
cvs server: Diffing test/src/nameworlduse
cvs server: Diffing test/src/nameworlduse/com
cvs server: Diffing test/src/nameworlduse/com/bea
cvs server: Diffing test/src/nameworlduse/com/bea/test
cvs server: Diffing test/src/numerals
cvs server: Diffing test/src/random
cvs server: Diffing test/src/schemas
cvs server: Diffing test/src/streamtest
cvs server: Diffing test/src/stsschema
cvs server: Diffing test/src/teststore
cvs server: Diffing test/src/teststore/com
cvs server: Diffing test/src/teststore/com/bea
cvs server: Diffing test/src/teststore/com/bea/test
cvs server: Diffing test/src/unmarshal
cvs server: Diffing test/src/unmarshal/com
cvs server: Diffing test/src/unmarshal/com/bea
cvs server: Diffing test/src/unmarshal/com/bea/test
cvs server: Diffing test/src/xmlpad
cvs server: Diffing test/src/xmlpad/org
cvs server: Diffing test/src/xmlpad/org/apache
cvs server: Diffing test/src/xmlpad/org/apache/xmlbeans
cvs server: Diffing test/src/xmlpad/org/apache/xmlbeans/impl
cvs server: Diffing test/src/xmlpad/org/apache/xmlbeans/impl/xmlpad
cvs server: Diffing test/src/xpath
cvs server: Diffing test/src/xpath/org
cvs server: Diffing test/src/xpath/org/apache
cvs server: Diffing test/src/xpath/org/apache/xmlbeans
cvs server: Diffing test/src/xpath/org/apache/xmlbeans/impl
cvs server: Diffing test/src/xpath/org/apache/xmlbeans/impl/xpath
cvs server: Diffing test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen
cvs server: Diffing test/src/xstypes
cvs server: Diffing xkit
cvs server: Diffing xkit/bin
cvs server: Diffing xkit/schemas
cvs server: Diffing xkit/schemas/cyclone
cvs server: Diffing xkit/schemas/cyclone/dsig
cvs server: Diffing xkit/schemas/easypo
cvs server: Diffing xkit/schemas/j2ee
cvs server: Diffing xkit/schemas/s4s

*****CVS exited normally with code 1*****


["Validator.java" (text/java)]

/*   Copyright 2004 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/*
* Enhancement for adding functionality to retrieve xml validation errors
* programatically contributed by Dutta Satadip
*/

package org.apache.xmlbeans.impl.validator;

import org.apache.xmlbeans.impl.common.Chars;
import org.apache.xmlbeans.impl.common.IdentityConstraint;
import org.apache.xmlbeans.impl.common.QNameHelper;
import org.apache.xmlbeans.impl.common.ValidationContext;
import org.apache.xmlbeans.impl.common.ValidatorListener.Event;
import org.apache.xmlbeans.impl.common.ValidatorListener;
import org.apache.xmlbeans.impl.common.XmlWhitespace;
import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
import org.apache.xmlbeans.impl.values.NamespaceContext;
import org.apache.xmlbeans.impl.values.JavaUriHolderEx;
import org.apache.xmlbeans.impl.values.JavaBase64HolderEx;
import org.apache.xmlbeans.impl.values.JavaBooleanHolderEx;
import org.apache.xmlbeans.impl.values.XmlDateImpl;
import org.apache.xmlbeans.impl.values.JavaDecimalHolderEx;
import org.apache.xmlbeans.impl.values.JavaDoubleHolderEx;
import org.apache.xmlbeans.impl.values.XmlDurationImpl;
import org.apache.xmlbeans.impl.values.JavaFloatHolderEx;
import org.apache.xmlbeans.impl.values.JavaHexBinaryHolderEx;
import org.apache.xmlbeans.impl.values.JavaBooleanHolder;
import org.apache.xmlbeans.impl.values.XmlQNameImpl;
import org.apache.xmlbeans.impl.values.JavaQNameHolderEx;
import org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx;
import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
import org.apache.xmlbeans.impl.values.XmlListImpl;
import org.apache.xmlbeans.GDate;
import org.apache.xmlbeans.GDuration;
import org.apache.xmlbeans.QNameSet;
import org.apache.xmlbeans.XmlQName;
import org.apache.xmlbeans.SchemaAttributeModel;
import org.apache.xmlbeans.SchemaField;
import org.apache.xmlbeans.SchemaLocalAttribute;
import org.apache.xmlbeans.SchemaLocalElement;
import org.apache.xmlbeans.SchemaGlobalElement;
import org.apache.xmlbeans.SchemaParticle;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlError;
import org.apache.xmlbeans.XmlValidationError;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.SimpleValue;
import org.apache.xmlbeans.SchemaProperty;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
import javax.xml.namespace.QName;

public final class Validator
    implements ValidatorListener
{
    public Validator (
        SchemaType type, SchemaField field, SchemaTypeLoader globalLoader,
        XmlOptions options, Collection defaultErrorListener )
    {
        options = XmlOptions.maskNull(options);
        _errorListener = (Collection) options.get(XmlOptions.ERROR_LISTENER);

        if (_errorListener == null)
            _errorListener = defaultErrorListener;

        _constraintEngine = new IdentityConstraint(_errorListener, \
type.isDocumentType());

        _globalTypes = globalLoader;
        _chars = new Chars();
        _rootType = type;
        _rootField = field;

        _vc = new ValidatorVC();
    }

    private class ValidatorVC implements ValidationContext
    {
        public void invalid ( String message )
        {
          // TODO Addtional Attributes for validation error have limited information
         //at this time but will be a part of the second round of refactoring


            Validator.this.emitError
                (
                _event,
                message,
                null,
                null,
                null,
                XmlValidationError.ATTRIBUTE_TYPE_INVALID,
                null
                );
        }

        Event _event;
    }

    public boolean isValid ( )
    {
        return !_invalid && _constraintEngine.isValid();
    }

    private void emitError ( Event event, String msg,
                             QName offendingQName, SchemaType expectedSchemaType ,
                             List expectedQNames , int errorType,
                             SchemaType badSchemaType)
    {
        emitError(event, msg, XmlError.SEVERITY_ERROR,
                  offendingQName , expectedSchemaType,
                  expectedQNames , errorType,
                  badSchemaType
        );

    }

    private void emitError ( Event event, String msg, int severity,
                             QName offendingQName, SchemaType expectedSchemaType ,
                             List expectedQNames , int errorType,
                             SchemaType badSchemaType )

    {
        _errorState++;

        if (_suspendErrors == 0)
        {
            if (severity == XmlError.SEVERITY_ERROR)
                _invalid = true;

            if (_errorListener != null)
            {
                assert event != null;
                _errorListener.add(
                    XmlValidationError.forCursorWithDetails
                       (
                           XmlError.forCursor( msg, severity, \
event.getLocationAsCursor()),  offendingQName,
                           expectedSchemaType,
                           expectedQNames,
                           errorType,
                           badSchemaType
                        )

                    );

            }
        }

    }

    private void emitFieldError ( Event event, String msg,
                                  QName offendingQName, SchemaType expectedSchemaType \
,  List expectedQNames , int errorType,
                                  SchemaType badSchemaType )

    {
        emitFieldError(event, msg, XmlError.SEVERITY_ERROR,
                       offendingQName , expectedSchemaType,
                       expectedQNames , errorType,
                       badSchemaType);

    }

    private void emitFieldError ( Event event, String msg, int severity,
                                  QName offendingQName, SchemaType expectedSchemaType \
,  List expectedQNames , int errorType,
                                  SchemaType badSchemaType )


    {
        if (_stateStack != null && _stateStack._field != null)
        {
            msg +=
                " in element " + QNameHelper.pretty( _stateStack._field.getName() );
        }

        Validator.this.emitError( event, msg, severity,
                                  offendingQName , expectedSchemaType,
                                  expectedQNames , errorType,
                                  badSchemaType);

    }

    // For XmlEventListener.error

    public void error ( XmlError error )
    {
        _errorState++;

        if (_suspendErrors == 0)
        {
            _invalid = true;

            if (_errorListener != null)
                _errorListener.add( error );
        }
    }

    public void nextEvent ( int kind, Event event )
    {
        resetValues();

        if (_eatContent > 0)
        {
            switch ( kind )
            {
            case END   : _eatContent--; break;
            case BEGIN : _eatContent++; break;
            }
        }
        else
        {
            assert
                kind == BEGIN || kind == ATTR ||
                    kind == END || kind == TEXT || kind == ENDATTRS;

            switch ( kind )
            {
            case BEGIN    : beginEvent(    event ); break;
            case ATTR     : attrEvent(     event ); break;
            case ENDATTRS : endAttrsEvent( event ); break;
            case TEXT     : textEvent(     event ); break;
            case END      : endEvent(      event ); break;
            }
        }
    }

    private void beginEvent ( Event event )
    {
        _localElement = null;
        _wildcardElement = null;
        String message = null;
        State state = topState();

        SchemaType  elementType  = null;
        SchemaField elementField = null;

        if (state == null)
        {
            elementType = _rootType;
            elementField = _rootField;
        }
        else
        {

            QName name = event.getName();

            assert name != null;

            state._isEmpty = false;

            if (state._isNil)
            {

              //offendingQName = state._field.getName();
              //expectedSchemaType = state._type;
              //errorType = XmlValidationError.NIL_ELEMENT;
              // The expected and the bad schema types are the same because nil \
elements cannot have element content  //badSchemaType = state._type;

                emitFieldError
                    (event,
                    "Nil element cannot have element content",
                    state._field.getName(),
                    state._type,
                    null,
                    XmlValidationError.NIL_ELEMENT,
                    state._type
                    );
                _eatContent = 1;
                return;
            }

            if (!state.visit( name ))
            {
                findDetailedErrorBegin(event ,state , name);
                /*
                if (message != null)
                {
                  emitFieldError(event, message);
                  message = null;
                }
                else
                {
                  emitFieldError(event, "Element not allowed:", name);
                }
                */
                _eatContent = 1;

                return;
            }

            SchemaParticle currentParticle = state.currentParticle();
            _wildcardElement = currentParticle;

            if (currentParticle.getParticleType() == SchemaParticle.WILDCARD)
            {
                //_wildcardElement = currentParticle;
                QNameSet elemWildcardSet = currentParticle.getWildcardSet();

                if (!elemWildcardSet.contains( name ))
                {
                    // Additional processing may be needed to generate more
                    // descriptive messages

                    //offendingQName = name;
                    //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
                    //badSchemaType = state._type;

                    emitFieldError
                        (
                        event,
                        "Element not allowed: " + QNameHelper.pretty(name) ,
                        name,
                        null,
                        null,
                        XmlValidationError.ELEMENT_NOT_ALLOWED,
                        state._type
                        );
                    _eatContent = 1;

                    return;
                }

                int wildcardProcess = currentParticle.getWildcardProcess();

                if (wildcardProcess == SchemaParticle.SKIP)
                {
                    _eatContent = 1;
                    return;
                }

                _localElement = _globalTypes.findElement( name );
                elementField = _localElement;

                if (elementField == null)
                {
                    if (wildcardProcess == SchemaParticle.STRICT)
                    {
                      //offendingQName = name;
                      //expectedSchemaType = state._type;
                      //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
                      //badSchemaType = state._type;

                        emitFieldError
                            (
                            event,
                            "Element not allowed (strict wildcard, and no definition \
found): " +  QNameHelper.pretty(name),  name,
                            state._type,
                            null,
                            XmlValidationError.ELEMENT_NOT_ALLOWED,
                            state._type
                            );
                    }

                    _eatContent = 1;

                    return;
                }
            }
            else
            {
                assert
                    currentParticle.getParticleType() == SchemaParticle.ELEMENT;

                // If the current element particle name does not match the name
                // of the event, then the current element is a substitute for
                // the current particle. Replace the field with the global
                // element for the replacement

                if (! currentParticle.getName().equals(name))
                {
                    if (((SchemaLocalElement)currentParticle).blockSubstitution())
                    {

                      //offendingQName = name;
                      //expectedSchemaType = state._type;
                      //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
                      //badSchemaType = state._type;

                        emitFieldError
                            (
                            event,
                            "Element substitution not allowed when group head has \
block='substitution'" + QNameHelper.pretty( name),  name,
                            state._type,
                            null,
                            XmlValidationError.ELEMENT_NOT_ALLOWED,
                            state._type
                            );
                        _eatContent = 1;
                        return;
                    }

                    SchemaGlobalElement newField = _globalTypes.findElement(name);

                    assert newField != null;

                    if (newField != null)
                    {
                        elementField = newField;
                        _localElement = newField;
                    }
                }
                else
                {
                    elementField = (SchemaField) currentParticle;
                }
            }

            elementType = elementField.getType();
        }

        assert elementType != null;

        //
        // the no-type is always invalid (even if there is an xsi:type)
        //

        if (elementType.isNoType())
        {
          //offendingQName = event.getName();
          //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

            emitFieldError
                (
                event,
                "Invalid type.",
                event.getName(),
                null,
                null,
                XmlValidationError.ELEMENT_TYPE_INVALID,
                null
                );


            _eatContent = 1;
        }

        //
        // See if the element has an xsi:type on it
        //

        SchemaType xsiType = null;

        if (event.getXsiType( _chars ))
        {
            String value = _chars.asString();

            // Turn off the listener so a public error message
            // does not get generated, but I can see if there was
            // an error through the error state

            int originalErrorState = _errorState;

            _suspendErrors++;

            try
            {
                _vc._event = null;

                xsiType =
                    _globalTypes.findType(
                        XmlQNameImpl.validateLexical( value, _vc, event ) );

            }
            catch ( Throwable t )
            {
                _errorState++;
            }
            finally
            {
                _suspendErrors--;
            }

            if (originalErrorState != _errorState)
            {

              //errorAttributes._offendingQName = event.getName();
              // not sure how to extract this one
              //expectedSchemaType = xsiType;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
              //badSchemaType = state._type;

                emitFieldError
                    (
                    event,
                    "Invalid xsi:type qname: '" + value + "'",
                    event.getName(),
                    xsiType,
                    null,
                    XmlValidationError.ELEMENT_TYPE_INVALID,
                    state._type
                    );

                _eatContent = 1;

                return;
            }
            else if (xsiType == null)
            {

              //offendingQName = event.getName();
              // NOT SURE errorAttributes._expectedSchemaType = xsiType;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

                emitError(event,  "Could not find xsi:type: '" + value + "'",
                          event.getName(),
                          null,
                          null,
                          XmlValidationError.ELEMENT_TYPE_INVALID,
                          null
                          );

                _eatContent = 1;

                return;
            }
        }

        if (xsiType != null && !xsiType.equals(elementType))
        {
            if (!elementType.isAssignableFrom(xsiType))
            {

              //offendingQName = event.getName();
              //expectedSchemaType = elementType;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
              //badSchemaType = state._type


                emitFieldError
                    (
                    event,
                    "Type '" + xsiType +
                        "' is not derived from '" + elementType + "'",
                    event.getName(),
                    elementType,
                    null,
                    XmlValidationError.ELEMENT_TYPE_INVALID,
                    state._type
                    );

                _eatContent = 1;

                return;
            }

            if (elementType.blockExtension())
            {
                for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
                      t = t.getBaseType() )
                {
                    if (t.getDerivationType() == SchemaType.DT_EXTENSION)
                    {

                      //offendingQName = event.getName();
                      //expectedSchemaType = elementType;
                      //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
                      //badSchemaType = state._type;

                        emitFieldError
                            (
                            event,
                            "Extension type: '" + xsiType +
                                "' may not be substituted for: '" +
                                    elementType + "'",
                            event.getName(),
                            elementType,
                            null,
                            XmlValidationError.ELEMENT_TYPE_INVALID,
                            state._type
                            );

                        _eatContent = 1;

                        return;
                    }
                }
            }

            if (elementType.blockRestriction())
            {
                for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
                      t = t.getBaseType() )
                {
                    if (t.getDerivationType() == SchemaType.DT_RESTRICTION)
                    {
                      //offendingQName = event.getName();
                      //expectedSchemaType = elementType;
                      //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
                      //badSchemaType = state._type;

                        emitFieldError
                            (
                            event,
                            "Restriction type: '" + xsiType +
                                "' may not be substituted for: '" +
                                    elementType + "'",
                            event.getName(),
                            elementType,
                            null,
                            XmlValidationError.ELEMENT_TYPE_INVALID,
                            state._type
                            );

                        _eatContent = 1;

                        return;
                    }
                }
            }

            if (elementField instanceof SchemaLocalElement)
            {
                SchemaLocalElement sle  = (SchemaLocalElement)elementField;
                _localElement = sle;

                if (sle.blockExtension() || sle.blockRestriction())
                {
                    for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
                          t = t.getBaseType() )
                    {
                        if ((t.getDerivationType() == SchemaType.DT_RESTRICTION && \
                sle.blockRestriction()) ||
                            (t.getDerivationType() == SchemaType.DT_EXTENSION && \
sle.blockExtension()))  {

                          //offendingQName = sle.getName();
                          //need to find a way to get the right type
                          //errorAttributes._expectedSchemaType = ;
                          //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;



                            emitError(
                                event,
                                "Derived type: '" + xsiType +
                                    "' may not be substituted for element '" +
                                    QNameHelper.pretty(sle.getName()) + "'" ,
                                    sle.getName(),
                                    null,
                                    null,
                                    XmlValidationError.ELEMENT_TYPE_INVALID,
                                    null
                                    );

                            _eatContent = 1;

                            return;
                        }
                    }
                }

            }

            elementType = xsiType;
        }

        if (elementField instanceof SchemaLocalElement)
        {
            SchemaLocalElement sle = (SchemaLocalElement)elementField;
            _localElement = sle;

            if (sle.isAbstract())
            {

              //offendingQName = sle.getName();
              //need to find a way to get the right type
              //errorAttributes._expectedSchemaType = ;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

                emitError(event,
                          "Element '" + QNameHelper.pretty(sle.getName()) +
                          "' is abstract and cannot be used in an instance.",
                          sle.getName(),
                          null,
                          null,
                          XmlValidationError.ELEMENT_TYPE_INVALID,
                          null
                          );
                _eatContent = 1;
                return;
            }
        }

        if (elementType != null && elementType.isAbstract())
        {

          //offendingQName = event.getName();
          //expectedSchemaType = elementType;
          //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
          //badSchemaType = state._type;

            emitFieldError
                (
                event,
                "Abstract type: " + elementType +
                    " cannot be used in an instance",
                event.getName(),
                elementType,
                null,
                XmlValidationError.ELEMENT_TYPE_INVALID,
                state._type
                );

            _eatContent = 1;

            return;
        }

        boolean isNil = false;
        boolean hasNil = false;

        if (event.getXsiNil(_chars))
        {
            _vc._event = event;
            isNil = JavaBooleanHolder.validateLexical(_chars.asString(), _vc);
            hasNil = true;
        }

        // note in schema spec 3.3.4, you're not even allowed to say xsi:nil="false" \
if you're not nillable!  if (hasNil && !elementField.isNillable())
        {

          //_offendingQName = elementField.getName();
          //_expectedSchemaType = elementField.getType();
          //_errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
          //_badSchemaType = state._type;

            emitFieldError
                (
                event,
                "Element has xsi:nil attribute but is not nillable",
                elementField.getName(),
                elementField.getType(),
                null,
                XmlValidationError.ELEMENT_TYPE_INVALID,
                state._type
                );

            _eatContent = 1;
            return;
        }

        newState( elementType, elementField, isNil );

        // Dispatch this element event to any identity constraints
        // As well as adding any new identity constraints that exist

        _constraintEngine.element(
            event,
            elementType,
            elementField instanceof SchemaLocalElement
                ? ((SchemaLocalElement) elementField).getIdentityConstraints()
                : null );
    }

    private void attrEvent ( Event event )
    {
        QName attrName = event.getName();

        State state = topState();

        if (state._attrs == null)
            state._attrs = new HashSet();

        if (state._attrs.contains( attrName ))
        {
          //offendingQName =attrName;
          //need additional logic to determine the expectedSchemaType
          //errorAttributes._expectedSchemaType = ;
          //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
          //badSchemaType = state._type;


            emitFieldError
                (
                event,
                "Duplicate attribute: " + QNameHelper.pretty( attrName ),
                attrName,
                null,
                null,
                XmlValidationError.INCORRECT_ATTRIBUTE,
                state._type
                );

            return;
        }

        state._attrs.add( attrName );

        if (!state._canHaveAttrs)
        {
          //offendingQName =attrName;
          //need additional logic to determine the expectedSchemaType
          //errorAttributes._expectedSchemaType = ;
          //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
          //badSchemaType = state._type;

            emitFieldError
                (
                event,
                "Can't have attributes",
                attrName,
                null,
                null,
                XmlValidationError.INCORRECT_ATTRIBUTE,
                state._type
                );
            return;
        }

        SchemaLocalAttribute attrSchema =
            state._attrModel == null
                ? null
                : state._attrModel.getAttribute( attrName );

        if (attrSchema != null)
        {
            _localAttribute = attrSchema;

            if (attrSchema.getUse() == SchemaLocalAttribute.PROHIBITED)
            {
              //offendingQName =attrName;
              //need additional logic to determine the expectedSchemaType
              //errorAttributes._expectedSchemaType = ;
              //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
              //badSchemaType = state._type;


                emitFieldError
                    (
                    event,
                    "Attribute is prohibited: "
                        + QNameHelper.pretty( attrName ),
                    attrName,
                    null,
                    null,
                    XmlValidationError.INCORRECT_ATTRIBUTE,
                    state._type
                    );


                return;
            }

            String value =
                validateSimpleType(
                    attrSchema.getType(), attrSchema, event, false, false );

            _constraintEngine.attr( event, attrName, attrSchema.getType(), value );

            return;
        }

        int wildcardProcess = state._attrModel.getWildcardProcess();
        _wildcardAttribute = state._attrModel;

        if (wildcardProcess == SchemaAttributeModel.NONE)
        {

          //offendingQName =attrName;
          //need additional logic to determine the expectedSchemaType
          //errorAttributes._expectedSchemaType = ;
          //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
          //badSchemaType = state._type;
            emitFieldError
                (
                event,
                "Attribute not allowed (no wildcards allowed): "
                    + QNameHelper.pretty( attrName ),
                attrName,
                null,
                null,
                XmlValidationError.INCORRECT_ATTRIBUTE,
                state._type
                );

            return;
        }

        QNameSet attrWildcardSet = state._attrModel.getWildcardSet();

        if (!attrWildcardSet.contains( attrName ))
        {

          //offendingQName =attrName;
          //need additional logic to determine the expectedSchemaType
          //errorAttributes._expectedSchemaType = ;
          //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
          //badSchemaType = state._type;

            emitFieldError(
                event,
                "Attribute not allowed: " + QNameHelper.pretty( attrName ),
                attrName,
                null,
                null,
                XmlValidationError.INCORRECT_ATTRIBUTE,
                state._type
                );

            return;
        }


        if (wildcardProcess == SchemaAttributeModel.SKIP)
            return;

        attrSchema = _globalTypes.findAttribute( attrName );
        _localAttribute = attrSchema;

        if (attrSchema == null)
        {
            if (wildcardProcess == SchemaAttributeModel.LAX)
                return;

            assert wildcardProcess == SchemaAttributeModel.STRICT;

            //offendingQName =attrName;
            //need additional logic to determine the expectedSchemaType
            //errorAttributes._expectedSchemaType = ;
            //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
            //badSchemaType = state._type;

            emitFieldError
                (
                event,
                "Attribute not allowed (strict wildcard, and no definition found): " \
+ QNameHelper.pretty( attrName ),  attrName,
                null,
                null,
                XmlValidationError.INCORRECT_ATTRIBUTE,
                state._type
                );


            return;
        }

        String value =
            validateSimpleType(
                attrSchema.getType(), attrSchema, event, false, false );

        _constraintEngine.attr( event, attrName, attrSchema.getType(), value );
    }

    private void endAttrsEvent ( Event event )
    {
        State state = topState();

        if (state._attrModel != null)
        {
            SchemaLocalAttribute[] attrs = state._attrModel.getAttributes();

            for ( int i = 0 ; i < attrs.length ; i++ )
            {
                SchemaLocalAttribute sla = attrs[ i ];

                if (state._attrs == null ||
                        !state._attrs.contains( sla.getName() ))
                {
                    if (sla.getUse() == SchemaLocalAttribute.REQUIRED)
                    {

                      //offendingQName = sla.getName();
                      //errorType = XmlValidationError.INCORRECT_ATTRIBUTE;
                      //badSchemaType = state._type;

                        emitFieldError
                            (
                            event,
                            "Expected attribute: " + QNameHelper.pretty \
(sla.getName()),  sla.getName(),
                            null,
                            null,
                            XmlValidationError.INCORRECT_ATTRIBUTE,
                            state._type
                            );
                    }
                    else if (sla.isDefault() || sla.isFixed())
                    {
                        _constraintEngine.attr(event, sla.getName(), sla.getType(), \
sla.getDefaultText());

                        // We don't need to validate attribute defaults because this \
is done at compiletime.  /*
                        String value = sla.getDefaultText();
                        SchemaType type = sla.getType();

                        if (XmlQName.type.isAssignableFrom(type))
                        {
                            emitFieldError(
                                event,
                                "Default QName values are unsupported for attribute: \
" +  QNameHelper.pretty(sla.getName()),
                                XmlError.SEVERITY_INFO);
                        }

                        else
                        {
                            validateSimpleType(
                                type, sla.getDefaultText(), event );

                            _constraintEngine.attr( event, type, value );
                        }
                        */
                    }
                }
            }
        }
    }

    private void endEvent ( Event event )
    {
        _localElement = null;
        _wildcardElement = null;
        String message = null;
        State state = topState();

        if (!state._isNil)
        {
            if (!state.end())
            {

                findDetailedErrorEnd(event,state);


            }

            // This end event has no text, use this fact to pass no text to
            // handleText

            if (state._isEmpty)
                handleText( event, true, state._field );
        }

        popState( event );

        _constraintEngine.endElement( event );
    }

    private void textEvent ( Event event )
    {
        State state = topState();

        if (state._isNil)
        {
          //offendingQName =state._field.getName();
          //expectedSchemaType = state._type ;
          //errorType = XmlValidationError.NIL_ELEMENT;
          //badSchemaType = state._type;

          emitFieldError
              (
              event,
              "Nil element cannot have simple content",
              state._field.getName(),
              state._type,
              null,
              XmlValidationError.NIL_ELEMENT,
              state._type
              );
        }
        else
            handleText( event, false, state._field );

        state._isEmpty = false;
    }


    private void handleText (
        Event event, boolean emptyContent, SchemaField field )
    {
        State state = topState();

        if (!state._sawText)
        {
            if (state._hasSimpleContent)
            {
                String value =
                    validateSimpleType(
                        state._type, field, event, emptyContent, true );

                _constraintEngine.text( event, state._type, value, false );
            }
            else if (emptyContent)
            {
                _constraintEngine.text( event, state._type, null, true );
            }
            else
                _constraintEngine.text( event, state._type, "", false);
        }

        if (!emptyContent && !state._canHaveMixedContent &&
            !event.textIsWhitespace() & !state._hasSimpleContent)
        {
            if (field instanceof SchemaLocalElement)
            {
                SchemaLocalElement e = (SchemaLocalElement)field;

                //offendingQName = e.getName();
                //expectedSchemaType = field.getType();
                //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

                emitError(event,
                          "Element: '" + QNameHelper.pretty(e.getName()) + "' cannot \
have mixed content.",  e.getName(),
                          field.getType(),
                          null,
                          XmlValidationError.ELEMENT_TYPE_INVALID,
                          null);
            }
            else
            {
              //offendingQName = not sure how to get this(event.getName()??);
              //expectedSchemaType = state._type;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;
              emitError(event,
                        "Can't have mixed content",
                        event.getName(),
                        state._type,
                        null,
                        XmlValidationError.ELEMENT_TYPE_INVALID,
                        null
                        );

            }
        }

        if (!emptyContent)
            state._sawText = true;
    }

    private void findDetailedErrorBegin(Event event, State state, QName qName)
    {
        String message = null;
        SchemaProperty[] eltProperties = state._type.getElementProperties();
        for (int ii = 0; ii < eltProperties.length; ii++)
        {
            //Get the element from the schema
            SchemaProperty sProp = eltProperties[ii];

            // test if the element is valid
            if (state.test(sProp.getName()))
            {
                message = "Expected element " + QNameHelper.pretty(sProp.getName()) + \
" instead of " + QNameHelper.pretty(qName) + " here";  ArrayList expectedNames = new \
ArrayList();  expectedNames.add(sProp.getName());


                //offendingQName = qName;
                //expectedSchemaType=sProp.getType();
                //errorType = XmlValidationError.INCORRECT_ELEMENT;
                //badSchemaType = state._type;
                //expectedQNames=sProp.getName();

                emitFieldError
                    (
                    event,
                    message,
                    qName,
                    sProp.getType(),
                    expectedNames,
                    XmlValidationError.INCORRECT_ELEMENT,
                    state._type
                    );


                break;
            }
        }
        if (message == null)
        {
          //offendingQName = qName;
          //severity =XmlError.SEVERITY_ERROR;
          //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
          //badSchemaType = state._type;

          emitFieldError
              (
              event,
              "Element not allowed: " + QNameHelper.pretty( qName),
              qName,
              null,
              null,
              XmlValidationError.INCORRECT_ELEMENT,
              state._type
              );
        }

    }

    private void findDetailedErrorEnd(Event event, State state)
    {
        SchemaProperty[] eltProperties  = state._type.getElementProperties();
        String message = null;

        for (int ii = 0; ii < eltProperties.length; ii++)
        {
            //Get the element from the schema
            SchemaProperty sProp = eltProperties[ii];

            // test if the element is valid
            if (state.test(sProp.getName()))
            {
                message = "Expected element " + QNameHelper.pretty(sProp.getName()) +
                          " at the end of the content";

                ArrayList expectedNames = new ArrayList();
                expectedNames.add(sProp.getName());

                //expectedSchemaType=sProp.getType();
                //errorType = XmlValidationError.INCORRECT_ELEMENT;
                //badSchemaType = state._type;
                //expectedQNames=(sProp.getName());

                emitFieldError
                    (event,
                    message,
                    null,
                    sProp.getType(),
                    expectedNames,
                    XmlValidationError.INCORRECT_ELEMENT,
                    state._type
                    );

                break;
            }
        }

        if (message == null)
        {
          //errorType = XmlValidationError.ELEMENT_NOT_ALLOWED;
          //badSchemaType = state._type;
          emitFieldError
              (
              event,
              "Expected element(s)",
              null,
              null,
              null,
              XmlValidationError.ELEMENT_NOT_ALLOWED,
              state._type);
        }


    }


    private final class State
    {
        boolean visit ( QName name )
        {
            return _canHaveElements && _visitor.visit( name );
        }

        boolean test( QName name )
        {
            return _canHaveElements && _visitor.testValid( name );
        }

        boolean end ( )
        {
            return !_canHaveElements || _visitor.visit( null );
        }

        SchemaParticle currentParticle ( )
        {
            assert _visitor != null;
            return _visitor.currentParticle();
        }

        SchemaType  _type;
        SchemaField _field;

        boolean _canHaveAttrs;
        boolean _canHaveMixedContent;
        boolean _hasSimpleContent;

        boolean _sawText;
        boolean _isEmpty;
        boolean _isNil;

        SchemaTypeVisitorImpl _visitor;
        boolean _canHaveElements;

        SchemaAttributeModel _attrModel;

        HashSet _attrs;

        State _next;
    }

    private void newState ( SchemaType type, SchemaField field, boolean isNil )
    {
        State state = new State();

        state._type = type;
        state._field = field;
        state._isEmpty = true;
        state._isNil = isNil;

        if (type.isSimpleType())
        {
            state._hasSimpleContent = true;
        }
        else
        {
            state._canHaveAttrs = true;
            state._attrModel = type.getAttributeModel();

            switch ( type.getContentType() )
            {
            case SchemaType.EMPTY_CONTENT :
                break;

            case SchemaType.SIMPLE_CONTENT :
                state._hasSimpleContent = true;
                break;

            case SchemaType.MIXED_CONTENT :
                state._canHaveMixedContent = true;
                // Fall through

            case SchemaType.ELEMENT_CONTENT :

                SchemaParticle particle = type.getContentModel();

                state._canHaveElements = particle != null;

                if (state._canHaveElements)
                    state._visitor = initVisitor( particle );

                break;

            default :
                throw new RuntimeException( "Unexpected content type" );
            }
        }

        pushState( state );
    }

    private void popState ( Event e )
    {
        if (_stateStack._visitor != null)
        {
            poolVisitor( _stateStack._visitor );
            _stateStack._visitor = null;
        }

        _stateStack = _stateStack._next;
    }

    private void pushState ( State state )
    {
        state._next = _stateStack;
        _stateStack = state;
    }

    private LinkedList _visitorPool = new LinkedList();

    private void poolVisitor( SchemaTypeVisitorImpl visitor )
    {
        _visitorPool.add( visitor );
    }

    private SchemaTypeVisitorImpl initVisitor( SchemaParticle particle )
    {
        if (_visitorPool.isEmpty())
            return new SchemaTypeVisitorImpl( particle );

        SchemaTypeVisitorImpl result =
            (SchemaTypeVisitorImpl) _visitorPool.removeLast();

        result.init( particle );

        return result;
    }

    private State topState ( )
    {
        return _stateStack;
    }

    //
    // Simple Type Validation
    //
    // emptyContent means that you can't use the event to get text: there is
    // no text, but you can use the event to do prefix resolution (in the case
    // where the default is a qname)
    //

    private String validateSimpleType (
        SchemaType type, SchemaField field, Event event,
        boolean emptyContent, boolean canApplyDefault )
    {
        if (!type.isSimpleType() &&
                type.getContentType() != SchemaType.SIMPLE_CONTENT)
        {
            assert false;
            // throw new RuntimeException( "Not a simple type" );
            return null; // should never happen
        }

        //
        // the no-type is always invalid
        //

        if (type.isNoType())
        {
          //offendingQName = field.getName();
          //expectedSchemaType = type;
          //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

            emitError(
            event,
            "Invalid type.",
            field.getName(),
            type,
            null,
            XmlValidationError.ELEMENT_TYPE_INVALID,
            null
            );
            return null;
        }

        // Get the value as a string (as normalized by the white space rule
        // TODO - will want to optimize this later

        String value = "";

        if (!emptyContent)
        {
            event.getText( _chars, type.getWhiteSpaceRule() );
            value = _chars.asString();
        }

        // See if I can apply a default/fixed value

        if (value.length() == 0 && canApplyDefault && field != null &&
                (field.isDefault() || field.isFixed()))
        {
            if (XmlQName.type.isAssignableFrom(type))
            {
              //offendingQName = field.getName();
              //expectedSchemaType = type;
              //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

                emitError(
                    event,
                    "Default QName values are unsupported for " +
                        QNameHelper.readable(type) + " - ignoring.",
                    XmlError.SEVERITY_INFO,
                    field.getName(),
                    type,
                    null,
                    XmlValidationError.ELEMENT_TYPE_INVALID,
                    null);

                return null;
            }

            String defaultValue =
                XmlWhitespace.collapse(
                    field.getDefaultText(), type.getWhiteSpaceRule() );

// BUGBUG - should validate defaultValue at compile time
            return
                validateSimpleType( type, defaultValue, event )
                    ? defaultValue
                    : null;
        }

        if (!validateSimpleType( type, value, event ))
            return null;

        if (field != null && field.isFixed())
        {
// TODO - fixed value should have been cooked at compile time
            String fixedValue =
                XmlWhitespace.collapse(
                    field.getDefaultText(), type.getWhiteSpaceRule() );

            if (!validateSimpleType( type, fixedValue, event ))
                return null;

            XmlObject val = type.newValue( value );
            XmlObject def = type.newValue( fixedValue );

            if (!val.valueEquals( def ))
            {
                // BUGBUG - make this more verbose

                //offendingQName = field.getName();
                //expectedSchemaType = field.getType();
                //errorType = XmlValidationError.ELEMENT_TYPE_INVALID;

                emitError
                    (
                    event,
                    "Value not equal to fixed value. " + value,
                    field.getName(),
                    field.getType(),
                    null,
                    XmlValidationError.ELEMENT_TYPE_INVALID,
                    null
                    );

                return null;
            }
        }

        return value;
    }

    private boolean validateSimpleType (
        SchemaType type, String value, Event event )
    {
        if (!type.isSimpleType() &&
                type.getContentType() != SchemaType.SIMPLE_CONTENT)
        {
            assert false;
            throw new RuntimeException( "Not a simple type" );
        }

        int retState = _errorState;

        switch ( type.getSimpleVariety() )
        {
        case SchemaType.ATOMIC : validateAtomicType( type, value, event );break;
        case SchemaType.UNION  : validateUnionType(  type, value, event );break;
        case SchemaType.LIST   : validateListType(   type, value, event );break;

        default : throw new RuntimeException( "Unexpected simple variety" );
        }

        return retState == _errorState;
    }

    private void validateAtomicType (
        SchemaType type, String value, Event event )
    {
        // Now we should have only an atomic type to validate

        assert type.getSimpleVariety() == SchemaType.ATOMIC;

        // Record the current error state to see if any new errors are made
        int errorState = _errorState;
        _vc._event = event;

        switch ( type.getPrimitiveType().getBuiltinTypeCode() )
        {
        case SchemaType.BTC_ANY_SIMPLE :
        {
            // Always valid!
            break;
        }
        case SchemaType.BTC_STRING :
        {
            JavaStringEnumerationHolderEx.validateLexical( value, type, _vc );
            _stringValue = value;
            break;
        }
        case SchemaType.BTC_DECIMAL :
        {
            JavaDecimalHolderEx.validateLexical( value, type, _vc );

            if (errorState == _errorState)
            {
                _decimalValue = new BigDecimal( value );
                JavaDecimalHolderEx.validateValue( _decimalValue, type, _vc );
            }

            break;
        }
        case SchemaType.BTC_BOOLEAN :
        {
            _booleanValue = JavaBooleanHolderEx.validateLexical( value, type, _vc );
            break;
        }
        case SchemaType.BTC_FLOAT :
        {
            float f =
                JavaFloatHolderEx.validateLexical( value, type, _vc );

            if (errorState == _errorState)
                JavaFloatHolderEx.validateValue( f, type, _vc );

            _floatValue = f;
            break;
        }
        case SchemaType.BTC_DOUBLE :
        {
            double d =
                JavaDoubleHolderEx.validateLexical( value, type, _vc );

            if (errorState == _errorState)
                JavaDoubleHolderEx.validateValue( d, type, _vc );

            _doubleValue = d;
            break;
        }
        case SchemaType.BTC_QNAME :
        {
            QName n =
                JavaQNameHolderEx.validateLexical(
                    value, type, _vc, event );

            if (errorState == _errorState)
                JavaQNameHolderEx.validateValue( n, type, _vc );

            _qnameValue = n;
            break;
        }
        case SchemaType.BTC_ANY_URI :
        {
            JavaUriHolderEx.validateLexical( value, type, _vc );
            _stringValue = value;
            break;
        }
        case SchemaType.BTC_DATE_TIME :
        case SchemaType.BTC_TIME :
        case SchemaType.BTC_DATE :
        case SchemaType.BTC_G_YEAR_MONTH :
        case SchemaType.BTC_G_YEAR :
        case SchemaType.BTC_G_MONTH_DAY :
        case SchemaType.BTC_G_DAY :
        case SchemaType.BTC_G_MONTH :
        {
            GDate d = XmlDateImpl.validateLexical( value, type, _vc );

            if (d != null)
                XmlDateImpl.validateValue( d, type, _vc );

            _gdateValue = d;
            break;
        }
        case SchemaType.BTC_DURATION :
        {
            GDuration d = XmlDurationImpl.validateLexical( value, type, _vc );

            if (d != null)
                XmlDurationImpl.validateValue( d, type, _vc );

            _gdurationValue = d;
            break;
        }
        case SchemaType.BTC_BASE_64_BINARY :
        {
            byte[] v =
                JavaBase64HolderEx.validateLexical( value, type, _vc );

            if (v != null)
                JavaBase64HolderEx.validateValue( v, type, _vc );

            _byteArrayValue = v;
            break;
        }
        case SchemaType.BTC_HEX_BINARY :
        {
            byte[] v =
                JavaHexBinaryHolderEx.validateLexical( value, type, _vc );

            if (v != null)
                JavaHexBinaryHolderEx.validateValue( v, type, _vc );

            _byteArrayValue = v;
            break;
        }
        case SchemaType.BTC_NOTATION :
            // Unimplemented.
            break;

        default :
            throw new RuntimeException( "Unexpected primitive type code" );
        }
    }

    private void validateListType (
        SchemaType type, String value, Event event )
    {
        int errorState = _errorState;

        if (!type.matchPatternFacet( value ))
        {
          //offending Qname not valid
          //expectedSchemaType = type;
          //errorType = XmlValidationError.LIST_INVALID;

            emitError
                (
                event,
                "List '" + value + "' does not match pattern for " + \
QNameHelper.readable(type),  null,
                type,
                null,
                XmlValidationError.LIST_INVALID,
                null
                );
        }

        String[] items = XmlListImpl.split_list(value);


        int i;
        XmlObject o;

        if ((o = type.getFacet( SchemaType.FACET_LENGTH )) != null)
        {
            if ((i = ((SimpleValue)o).getIntValue()) != items.length)
            {
              //offending Qname not valid
              //expectedSchemaType = type;
              //errorType = XmlValidationError.LIST_INVALID;

                emitError
                    (
                    event,
                    "List (" + value + ") does not have " + i +
                        " items per length facet for " + QNameHelper.readable(type),
                    null,
                    type,
                    null,
                    XmlValidationError.LIST_INVALID,
                    null
                    );
            }
        }

        if ((o = type.getFacet( SchemaType.FACET_MIN_LENGTH )) != null)
        {
            if ((i = ((SimpleValue)o).getIntValue()) > items.length)
            {
              //offending Qname not valid
              //expectedSchemaType = type;
              //errorType = XmlValidationError.LIST_INVALID;

                emitError
                    (
                    event,
                    "List (" + value + ") has only " + items.length +
                        " items, fewer than min length facet (" + i + ") for " + \
QNameHelper.readable(type),  null,
                    type,
                    null,
                    XmlValidationError.LIST_INVALID,
                    null
                    );

            }
        }

        if ((o = type.getFacet( SchemaType.FACET_MAX_LENGTH )) != null)
        {
            if ((i = ((SimpleValue)o).getIntValue()) < items.length)
            {

              //offending Qname not valid
              //expectedSchemaType = type;
              //errorType = XmlValidationError.LIST_INVALID;

                emitError
                (
                event,
                "List (" + value + ") has " + items.length +
                    " items, more than max length facet (" + i + ") for " + \
QNameHelper.readable(type),  null,
                type,
                null,
                XmlValidationError.LIST_INVALID,
                null
                );

            }
        }

        SchemaType itemType = type.getListItemType();
        _listValue = new ArrayList();
        _listTypes = new ArrayList();

        for ( i = 0 ; i < items.length ; i++ )
        {
            validateSimpleType(
                itemType, items[i], event );
            addToList(itemType);
        }

        // If no errors up to this point, then I can create an
        // XmlList from this value and campare it again enums.

        if (errorState == _errorState)
        {
            if (type.getEnumerationValues() != null)
            {
                // Lists which contain QNames will need a resolver

                NamespaceContext.push(
                    new NamespaceContext( event ) );

                try
                {
                    XmlObject listValue = ( (SchemaTypeImpl) \
type).newValidatingValue( value );  }
                catch (XmlValueOutOfRangeException e)
                {
                  //offending Qname not valid ??
                  //expectedSchemaType = type;
                  //errorType = XmlValidationError.LIST_INVALID;
                    emitError
                    (
                    event,
                    "List value (" + value +
                        ") is not a valid enumeration value for " + \
QNameHelper.readable(type),  null,
                    type,
                    null,
                    XmlValidationError.LIST_INVALID,
                    null
                    );
                }
                finally
                {
                    NamespaceContext.pop();
                }
            }
        }
    }

    private void validateUnionType (
        SchemaType type, String value, Event event )
    {
        // TODO - if xsi:type is specified on a union, it selects
        // that union member type

        if (!type.matchPatternFacet( value ))
        {
          //offending Qname not valid ??
          //expectedSchemaType = type;
          //errorType = XmlValidationError.UNION_INVALID;

            emitError
            (
            event,
            "Union '" + value + "' does not match pattern for " + \
QNameHelper.readable(type),  null,
            type,
            null,
            XmlValidationError.UNION_INVALID,
            null
            );

        }

        int currentWsr = SchemaType.WS_PRESERVE;
        String currentValue = value;

        SchemaType[] types = type.getUnionMemberTypes();

        int originalState = _errorState;

        int i;
        for ( i = 0 ; i < types.length ; i++ )
        {
            int memberWsr = types[ i ].getWhiteSpaceRule();

            if (memberWsr == SchemaType.WS_UNSPECIFIED)
                memberWsr = SchemaType.WS_PRESERVE;

            if (memberWsr != currentWsr)
            {
                currentWsr = memberWsr;
                currentValue = XmlWhitespace.collapse( value, currentWsr );
            }

            int originalErrorState = _errorState;

            _suspendErrors++;

            try
            {
                validateSimpleType( types[ i ], currentValue, event );
            }
            finally
            {
                _suspendErrors--;
            }

            if (originalErrorState == _errorState)
            {
                _unionType = types[i];
                break;
            }
        }

        _errorState = originalState;

        if (i >= types.length)
        {

          //offending Qname not valid ??
          //expectedSchemaType = type;
          //errorType = XmlValidationError.UNION_INVALID;

            emitError
                (
                event,
                "Union '" + value + "' does not match any members of " + \
QNameHelper.readable(type),  null,
                type,
                null,
                XmlValidationError.UNION_INVALID,
                null
                );

        }
        else
        {
            XmlObject[] unionEnumvals = type.getEnumerationValues();

            if (unionEnumvals != null)
            {
                // Unions which contain QNames will need a resolver

                NamespaceContext.push( new NamespaceContext( event ) );

                try
                {
                    XmlObject unionValue = type.newValue( value );

                    for ( i = 0 ; i < unionEnumvals.length ; i++ )
                    {
                        if (unionValue.valueEquals( unionEnumvals[ i ] ))
                            break;
                    }

                    if (i >= unionEnumvals.length)
                    {

                      //offending Qname not valid ??
                      //expectedSchemaType = type;
                      //errorType = XmlValidationError.UNION_INVALID;

                        emitError
                            (
                            event,
                            "Union '" + value +
                                "' is not a valid enumeration value for " + \
QNameHelper.readable(type),  null,
                            type,
                            null,
                            XmlValidationError.UNION_INVALID,
                            null
                            );

                    }
                }
                catch (XmlValueOutOfRangeException e)
                {
                    // actually, the current union code always ends up here when \
invalid

                    //offending Qname not valid ??
                    //expectedSchemaType = type;
                    //errorType = XmlValidationError.UNION_INVALID;

                    emitError
                        (
                        event,
                        "Union '" + value +
                            "' is not a valid enumeration value for " + \
QNameHelper.readable(type),  null,
                        type,
                        null,
                        XmlValidationError.UNION_INVALID,
                        null
                        );



                }
                finally
                {
                    NamespaceContext.pop();
                }
            }
        }
    }

    private void addToList(SchemaType type)
    {
        if (type.getSimpleVariety() != SchemaType.ATOMIC)
            return;

        if (type.getUnionMemberTypes().length>0 && getUnionType()!=null)
        {
            type = getUnionType();
            _unionType = null;
        }

        _listTypes.add(type);

        switch ( type.getPrimitiveType().getBuiltinTypeCode() )
        {
            case SchemaType.BTC_ANY_SIMPLE :
                {
                    _listValue.add(_stringValue);
                    break;
                }
            case SchemaType.BTC_STRING :
                {
                    _listValue.add(_stringValue);
                    _stringValue = null;
                    break;
                }
            case SchemaType.BTC_DECIMAL :
                {
                    _listValue.add( _decimalValue );
                    _decimalValue = null;
                    break;
                }
            case SchemaType.BTC_BOOLEAN :
                {
                    _listValue.add(_booleanValue ? Boolean.TRUE : Boolean.FALSE);
                    _booleanValue = false;
                    break;
                }
            case SchemaType.BTC_FLOAT :
                {
                    _listValue.add(new Float(_floatValue));
                    _floatValue = 0;
                    break;
                }
            case SchemaType.BTC_DOUBLE :
                {
                    _listValue.add(new Double(_doubleValue));
                    _doubleValue = 0;
                    break;
                }
            case SchemaType.BTC_QNAME :
                {
                    _listValue.add(_qnameValue);
                    _qnameValue = null;
                    break;
                }
            case SchemaType.BTC_ANY_URI :
                {
                    _listTypes.add(_stringValue);
                    break;
                }
            case SchemaType.BTC_DATE_TIME :
            case SchemaType.BTC_TIME :
            case SchemaType.BTC_DATE :
            case SchemaType.BTC_G_YEAR_MONTH :
            case SchemaType.BTC_G_YEAR :
            case SchemaType.BTC_G_MONTH_DAY :
            case SchemaType.BTC_G_DAY :
            case SchemaType.BTC_G_MONTH :
                {
                    _listValue.add(_gdateValue);
                    _gdateValue = null;
                    break;
                }
            case SchemaType.BTC_DURATION :
                {
                    _listValue.add(_gdurationValue);
                    _gdurationValue = null;
                    break;
                }
            case SchemaType.BTC_BASE_64_BINARY :
                {
                    _listValue.add(_byteArrayValue);
                    _byteArrayValue = null;
                    break;
                }
            case SchemaType.BTC_HEX_BINARY :
                {
                    _listValue.add(_byteArrayValue);
                    _byteArrayValue = null;
                    break;
                }
            case SchemaType.BTC_NOTATION :
                {
                    _listValue.add(_stringValue);
                    _stringValue = null;
                    break;
                }

            default :
                throw new RuntimeException( "Unexpected primitive type code" );
        }
    }

    //
    // Members of the validator class
    //

    private boolean            _invalid;
    private SchemaType         _rootType;
    private SchemaField        _rootField;
    private SchemaTypeLoader   _globalTypes;
    private Chars              _chars;
    private State              _stateStack;
    private int                _errorState;
    private Collection         _errorListener;
    private ValidatorVC        _vc;
    private int                _suspendErrors;
    private IdentityConstraint _constraintEngine;
    private int                _eatContent;

    private SchemaLocalElement   _localElement;
    private SchemaParticle       _wildcardElement;
    private SchemaLocalAttribute _localAttribute;
    private SchemaAttributeModel _wildcardAttribute;
    private SchemaType           _unionType;

    // Strongly typed values
    private String _stringValue;
    private BigDecimal _decimalValue;
    private boolean _booleanValue;
    private float _floatValue;
    private double _doubleValue;
    private QName _qnameValue;
    private GDate _gdateValue;
    private GDuration _gdurationValue;
    private byte[] _byteArrayValue;
    private List _listValue;
    private List _listTypes;

    private void resetValues()
    {
        _localAttribute = null;
        _wildcardAttribute = null;
        _stringValue = null;
        _decimalValue = null;
        _booleanValue = false;
        _floatValue = 0;
        _doubleValue = 0;
        _qnameValue = null;
        _gdateValue = null;
        _gdurationValue = null;
        _byteArrayValue = null;
        _listValue = null;
        _listTypes = null;
        _unionType = null;
        _localAttribute = null;
    }

    public SchemaLocalElement getCurrentElement()
    {
        if (_localElement != null)
            return _localElement;

        // it means the element is to be skiped and it doesn't have a known \
SchemaLocalElement  if (_eatContent>0)
            return null;

        //try getting it from the stack (this should happen after END)
        if (_stateStack!=null && _stateStack._field instanceof SchemaLocalElement )
            return (SchemaLocalElement)_stateStack._field;

        return null;
    }

    public SchemaParticle getCurrentWildcardElement()
    {
        return _wildcardElement;
    }

    public SchemaLocalAttribute getCurrentAttribute()
    {
        return _localAttribute;
    }

    public SchemaAttributeModel getCurrentWildcardAttribute()
    {
        return _wildcardAttribute;
    }

    public String getStringValue()
    {
        return _stringValue;
    }

    public BigDecimal getDecimalValue()
    {
        return _decimalValue;
    }

    public boolean getBooleanValue()
    {
        return _booleanValue;
    }

    public float getFloatValue()
    {
        return _floatValue;
    }

    public double getDoubleValue()
    {
        return _doubleValue;
    }

    public QName getQNameValue()
    {
        return _qnameValue;
    }

    public GDate getGDateValue()
    {
        return _gdateValue;
    }

    public GDuration getGDurationValue()
    {
        return _gdurationValue;
    }

    public byte[] getByteArrayValue()
    {
        return _byteArrayValue;
    }

    public List getListValue()
    {
        return _listValue;
    }

    public List getListTypes()
    {
        return _listTypes;
    }

    public SchemaType getUnionType()
    {
        return _unionType;
    }
}


["XmlValidationError.java" (text/java)]

/*   Copyright 2004 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/*
* Contributed by Dutta Satadip for adding functionality to retrieve xml validation errors
* programatically
*/
package org.apache.xmlbeans;

import java.util.List;
import org.apache.xmlbeans.XmlError;
import javax.xml.namespace.QName;

/**
 *
 *
 * The XMLValidationError Class extends the {@link XMLError }XMLError class. The XML Validator contains
 * extra attributes that can be used to construct the XML validation error programatically.
 * <p>
 * To extract the validation error cast the errors to XMLValidationError instead of
 * XMLError for example
 * <br>
 * <pre>
 * xobj.validate(new XmlOptions().setErrorListener(errors))
 * for (Iterator it = errors.iterator(); it.hasNext(); )
 * {
 *   XMLValidationError err = (XMLValidationErro)it.next());
 * }
 *</pre>
 *
 *
 * Whenever an XML valiadtion error is retrieved it will always be populated with
 * the following information
 * <ul>
 * <li>Message</li>
 * <li>Severity</li>
 * <li>Error Type </li>
 * </ul>
 *
 * <p>
 *  The error type is very important because the other attributes of the
 * XMLValidationError are populated based on the error type.
 * <p>
 * if errortype= INCORRECT_ELEMENT then
 * <br>
 * offendingQName, badSchemaType will always be present, however expectedSchemaType and
 * expectedQNames are available only if it is possible to determine them during vaildation.
 *<br>
 *
 * <p>
 * if errortype= ELEMENT_NOT_ALLOWED then
 * <br>
 * badSchemaType will always be present, however expectedSchemaType and
 * offendingQName are available only if it is possible to determine them during vaildation.
 *<br>
 *
 * <p>
 * if errortype= INCORRECT_ATTRIBUTE then
 * <br>
 * offendingQName, badSchemaType will always be present
 *<br>
 *
 * <p>
 * if errortype= ATTRIBUTE_TYPE_INVALID  then
 * <br>
 * no other addtional attributes are populated
 * <br>
 *
 * <p>
 * if errortype= LIST_INVALID  then
 * <br>
 * expectedSchemaType will always be present
 *<br>
 *
 *<p>
 * if errortype= UNION_INVALID  then
 * <br>
 * expectedSchemaType will always be present
 * <br>
 *
 *
 *<p>
 * if errortype= NIL_ELEMENT  then
 * <br>
 * offendingQName, expectedSchemaType and badSchemaType  will always be present
 * <br>
 *
 *<p>
 * if errortype= ELEMENT_TYPE_INVALID  then
 * <br>
 * offendingQName  will always be present, other attributes may be available
 * <br>
 *
 *
 *
 */

public class XmlValidationError extends XmlError{
  public static final int INCORRECT_ELEMENT       = 1;
  public static final int ELEMENT_NOT_ALLOWED     = 2;
  public static final int ELEMENT_TYPE_INVALID    = 3;
  public static final int NIL_ELEMENT             = 4;

  public static final int INCORRECT_ATTRIBUTE       = 1000;
  public static final int ATTRIBUTE_TYPE_INVALID    = 1001;

  public static final int LIST_INVALID           = 2000;
  public static final int UNION_INVALID          = 3000;

  public static final int UNDEFINED              = 10000;



  private QName  _offendingQName;
  private SchemaType _expectedSchemaType;

  private List  _expectedQNames;
  private int _errorType;

  private SchemaType _badSchemaType;


  public XmlValidationError(XmlError xmlerror){
    super(xmlerror);

  }

    public static XmlValidationError forCursorWithDetails(XmlError xmlerror,
                                                QName offendingQname ,
                                                SchemaType expectedSchemaType,
                                                List expectedQNames,
                                                int errorType ,
                                                SchemaType badSchemaType)
    {
      XmlValidationError  validationError= new XmlValidationError(xmlerror);
      validationError.setOffendingQName(offendingQname);
      validationError.setExpectedSchemaType(expectedSchemaType);
      validationError.setExpectedQNames(expectedQNames);
      validationError.setErrorType(errorType);
      validationError.setBadSchemaType(badSchemaType);
      return validationError;
    }


  public SchemaType getBadSchemaType()
  {
    return _badSchemaType;
  }
  public void setBadSchemaType(SchemaType _badSchemaType)
  {
    this._badSchemaType = _badSchemaType;
  }
  public int getErrorType()
  {
    return _errorType;
  }
  public void setErrorType(int _errorType)
  {
    this._errorType = _errorType;
  }

  public List getExpectedQNames()
  {
    return _expectedQNames;
  }

  public void setExpectedQNames(List _expectedQNames)
  {
    this._expectedQNames = _expectedQNames;
  }

  public QName getOffendingQName()
  {
    return _offendingQName;
  }
  public void setOffendingQName(QName _offendingQName)
  {
    this._offendingQName = _offendingQName;
  }

  public SchemaType getExpectedSchemaType()
  {
    return _expectedSchemaType;
  }

  public void setExpectedSchemaType(SchemaType _expectedSchemaType)
  {
    this._expectedSchemaType = _expectedSchemaType;
  }





}


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic