Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]
org.apache.xmlbeans
public class: XmlValidationError [javadoc | source]
java.lang.Object
   org.apache.xmlbeans.XmlError
      org.apache.xmlbeans.XmlValidationError

All Implemented Interfaces:
    java$io$Serializable

The XmlValidationError class extends the XmlError XMLError class. The XML Validator contains extra attributes that can be used to construct the XML validation error programatically.

To extract the validation error cast the errors to XmlValidationError instead of XmlError for example:

xobj.validate(new XmlOptions().setErrorListener(errors))
for (Iterator it = errors.iterator(); it.hasNext(); )
{
     XmlError err = (XmlError)it.next());
     if (err instanceof XmlValidationError)
     {
         XmlValidationError validationError = (XmlValidationError) err;
    }
}
Whenever an XmlValidationError is retrieved it will always be populated with the following information:

The error type is very important because the other attributes of the XMLValidationError are populated based on the error type.

if errortype == INCORRECT_ELEMENT then
offendingQName, badSchemaType will always be present, however expectedSchemaType and expectedQNames are available only if it is possible to determine them during vaildation.

if errortype == ELEMENT_NOT_ALLOWED then
badSchemaType will always be present, however expectedSchemaType and offendingQName are available only if it is possible to determine them during vaildation.

if errortype == INCORRECT_ATTRIBUTE then
offendingQName, badSchemaType will always be present

if errortype == ATTRIBUTE_TYPE_INVALID then
no other addtional attributes are populated

if errortype == LIST_INVALID then
expectedSchemaType will always be present

if errortype == UNION_INVALID then
expectedSchemaType will always be present

if errortype == NIL_ELEMENT then
offendingQName, expectedSchemaType and badSchemaType will always be present

if errortype == ELEMENT_TYPE_INVALID then
offendingQName will always be present, other attributes may be available
Field Summary
public static final  int INCORRECT_ELEMENT     
public static final  int ELEMENT_NOT_ALLOWED     
public static final  int ELEMENT_TYPE_INVALID     
public static final  int NIL_ELEMENT     
public static final  int INCORRECT_ATTRIBUTE     
public static final  int ATTRIBUTE_TYPE_INVALID     
public static final  int LIST_INVALID     
public static final  int UNION_INVALID     
public static final  int UNDEFINED     
Fields inherited from org.apache.xmlbeans.XmlError:
SEVERITY_ERROR,  SEVERITY_WARNING,  SEVERITY_INFO
Method from org.apache.xmlbeans.XmlValidationError Summary:
forCursorWithDetails,   forLocationWithDetails,   getBadSchemaType,   getErrorType,   getExpectedQNames,   getExpectedSchemaType,   getFieldQName,   getMessage,   getOffendingQName,   setBadSchemaType,   setErrorType,   setExpectedQNames,   setExpectedSchemaType,   setFieldQName,   setOffendingQName
Methods from org.apache.xmlbeans.XmlError:
forCursor,   forCursor,   forCursor,   forCursor,   forLocation,   forLocation,   forLocation,   forLocation,   forLocationAndCursor,   forMessage,   forMessage,   forMessage,   forMessage,   forObject,   forObject,   forObject,   forObject,   forSource,   forSource,   forSource,   formattedFileName,   formattedMessage,   getColumn,   getCursorLocation,   getErrorCode,   getLine,   getLocation,   getMessage,   getObjectLocation,   getOffset,   getSeverity,   getSourceName,   severityAsString,   toString,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xmlbeans.XmlValidationError Detail:
 public static XmlValidationError forCursorWithDetails(String message,
    String code,
    Object[] args,
    int severity,
    XmlCursor cursor,
    QName fieldQName,
    QName offendingQname,
    SchemaType expectedSchemaType,
    List expectedQNames,
    int errorType,
    SchemaType badSchemaType) 
 public static XmlValidationError forLocationWithDetails(String message,
    String code,
    Object[] args,
    int severity,
    Location location,
    QName fieldQName,
    QName offendingQname,
    SchemaType expectedSchemaType,
    List expectedQNames,
    int errorType,
    SchemaType badSchemaType) 
 public SchemaType getBadSchemaType() 
 public int getErrorType() 
 public List getExpectedQNames() 
 public SchemaType getExpectedSchemaType() 
 public QName getFieldQName() 
 public String getMessage() 
 public QName getOffendingQName() 
 public  void setBadSchemaType(SchemaType _badSchemaType) 
 public  void setErrorType(int _errorType) 
 public  void setExpectedQNames(List _expectedQNames) 
 public  void setExpectedSchemaType(SchemaType _expectedSchemaType) 
 public  void setFieldQName(QName _fieldQName) 
 public  void setOffendingQName(QName _offendingQName)