Top Description Inners Constructors Methods
com.sun.msv.verifier

public abstract Class ErrorInfo

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.msv.verifier.ErrorInfo.ElementErrorInfo, com.sun.msv.verifier.ErrorInfo.BadText
Imports
com.sun.msv.util.StartTagInfo

Instances of this class is attached to ValidityViolation to provide detailed information about the error.

Warning

error information is highly sensitive to the internal change of MSV. A new subclass of ErrorInfo may be added, or existing subclasses may be removed. So your code that uses this information may be affected by future changes of MSV.

Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ErrorInfo.BadAttribute

Bad attribute.

public static class
ErrorInfo.BadTagName

Bad tag name.

public static class
public abstract static class
ErrorInfo.ElementErrorInfo

Base class for element related errors.

public static class
ErrorInfo.IncompleteContentModel

This error occurs when MSV sees an end tag unexpectedly.

public static class
ErrorInfo.MissingAttribute

Missing attribute.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ErrorInfoback to summary
public ErrorInfo()
com.sun.msv.verifier back to summary

public Class ErrorInfo.BadAttribute

extends ElementErrorInfo
Class Inheritance

Bad attribute.

This is an error when the attribute name is wrong, or the attribute value is wrong. For example:

  1. When MSV sees an unexpected attribute name:
    <img hreeef="logo.gif"/>
    
    
    
  2. When an attribute value does not match the specified datatype. For example, the following document causes this error if the "width" attribute is specified as the int type.
    <img href="logo.gif" width="twenty four pixels" />
    

This error is reported in the startElement callback.

Currently, the application cannot easily distinguish whether this error is caused by an invalid attribute value, or invalid attribute name. It is also non-trivial for MSV to detect this difference correctly. But there maybe applications to which this difference is important. I welcome any comments on this issue.

Field Summary

Modifier and TypeField and Description
public final String
public final String
public final String
attQName

information about the attribute that caused the error.

public final String
Inherited from com.sun.msv.verifier.ErrorInfo.ElementErrorInfo:
localNamenamespaceURIqName

Constructor Summary

AccessConstructor and Description
protected

Field Detail

attLocalNameback to summary
public final String attLocalName
attNamespaceURIback to summary
public final String attNamespaceURI
attQNameback to summary
public final String attQName

information about the attribute that caused the error.

attValueback to summary
public final String attValue

Constructor Detail

BadAttributeback to summary
protected BadAttribute(StartTagInfo sti, String qn, String ns, String loc, String v)
com.sun.msv.verifier back to summary

public Class ErrorInfo.BadTagName

extends ElementErrorInfo
Class Inheritance

Bad tag name.

This type of error occurs when MSV finds an unexpected tag name. For example:

  1. When a tag name appears where it is not valid to appear.
    <html>
      <head> ... </head>
      <head> ... </head> <!-- head cannot appear here -->
      <body> ... </body>
    </html>
    </pre>
    
    
  2. When there is a typo in the tag name.
    <html>
      <heed> ... </heed> <!-- typo -->
      <body> ... </body>
    </pre>
    
    
  3. When an element appears where no element is allowed at all.
    <html>
      <head>
        <meta ...>
          <junk/>   <!-- meta cannot have any children -->
    

This error is reported when the startElement callback is called.

Field Summary

Inherited from com.sun.msv.verifier.ErrorInfo.ElementErrorInfo:
localNamenamespaceURIqName

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

BadTagNameback to summary
public BadTagName(String qn, String ns, String loc)
BadTagNameback to summary
public BadTagName(StartTagInfo sti)
com.sun.msv.verifier back to summary

public Class ErrorInfo.BadText

extends ErrorInfo
Class Inheritance

Bad text.

This type of errors indicate that the document contains PCDATA but it is not good. Here are typical examples of this error.

  1. PCDATA appears where no text is allowed at all. For example:
    <html>
      <head> ... </head>
      ** invalid text **
      <body> ... </body>
    </html>
    
  2. text was not a correct value for the given datatype. For example,
    <!-- when "integer" is expected -->
    <length> five </length>
    

Usually, the user can fix this error by removing or chaning the text.

MSV validates text after it collects the whole string. That means MSV does not validate text in the SAX's characters callback. As a result, this error is reported after the next start tag or end tag is found.

For example, in the above example, the error is reported when MSV reads <body>(start tag) and </length> (end tag) respectively.

Field Summary

Modifier and TypeField and Description
public final String
literal

The actual text that caused the error.

Constructor Summary

AccessConstructor and Description
public
BadText(String _literal)

public

Field Detail

literalback to summary
public final String literal

The actual text that caused the error.

Constructor Detail

BadTextback to summary
public BadText(String _literal)
BadTextback to summary
public BadText(StringBuffer _literal)
com.sun.msv.verifier back to summary

public abstract Class ErrorInfo.ElementErrorInfo

extends ErrorInfo
Class Inheritance
Known Direct Subclasses
com.sun.msv.verifier.ErrorInfo.BadTagName, com.sun.msv.verifier.ErrorInfo.BadAttribute, com.sun.msv.verifier.ErrorInfo.MissingAttribute, com.sun.msv.verifier.ErrorInfo.IncompleteContentModel

Base class for element related errors.

Field Summary

Modifier and TypeField and Description
public final String
public final String
public final String
qName

tag name information.

Constructor Summary

AccessConstructor and Description
public
public

Field Detail

localNameback to summary
public final String localName
namespaceURIback to summary
public final String namespaceURI
qNameback to summary
public final String qName

tag name information.

Constructor Detail

ElementErrorInfoback to summary
public ElementErrorInfo(String qn, String ns, String loc)
ElementErrorInfoback to summary
public ElementErrorInfo(StartTagInfo sti)
com.sun.msv.verifier back to summary

public Class ErrorInfo.IncompleteContentModel

extends ElementErrorInfo
Class Inheritance

This error occurs when MSV sees an end tag unexpectedly. For example:
<html>
  <head> ... </head>
</html>  <!-- where is the body element? -->

Usually, this means that additional elements and/or PCDATA are necessary to make the document valid.

Fields of the class provide information about enclosing tag. (In case of the above example, it is html.)

Field Summary

Inherited from com.sun.msv.verifier.ErrorInfo.ElementErrorInfo:
localNamenamespaceURIqName

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

IncompleteContentModelback to summary
public IncompleteContentModel(String qn, String ns, String loc)
IncompleteContentModelback to summary
public IncompleteContentModel(StartTagInfo sti)
com.sun.msv.verifier back to summary

public Class ErrorInfo.MissingAttribute

extends ElementErrorInfo
Class Inheritance

Missing attribute.

This type of error occurs only when required attributes are missing. Note that the fields of this class provide information about the element, not the attribute which is missing.

<img/>  <!-- where is the href attribute? -->

Field Summary

Inherited from com.sun.msv.verifier.ErrorInfo.ElementErrorInfo:
localNamenamespaceURIqName

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

MissingAttributeback to summary
public MissingAttribute(String qn, String ns, String loc)
MissingAttributeback to summary
public MissingAttribute(StartTagInfo sti)