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.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ErrorInfo.BadAttribute
Bad attribute. |
| public static class | ErrorInfo.BadTagName
Bad tag name. |
| public static class | ErrorInfo.BadText
Bad text. |
| 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. |
| Access | Constructor and Description |
|---|---|
| public |
| ErrorInfo | back to summary |
|---|---|
| public ErrorInfo() | |
This is an error when the attribute name is wrong, or the attribute value is wrong. For example:
<img hreeef="logo.gif"/>
<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.
| Modifier and Type | Field and Description |
|---|---|
| public final String | |
| public final String | |
| public final String | attQName
information about the attribute that caused the error. |
| public final String |
| Access | Constructor and Description |
|---|---|
| protected |
| attLocalName | back to summary |
|---|---|
| public final String attLocalName | |
| attNamespaceURI | back to summary |
|---|---|
| public final String attNamespaceURI | |
| attQName | back to summary |
|---|---|
| public final String attQName information about the attribute that caused the error. | |
| attValue | back to summary |
|---|---|
| public final String attValue | |
| BadAttribute | back to summary |
|---|---|
| protected BadAttribute(StartTagInfo sti, String qn, String ns, String loc, String v) | |
This type of error occurs when MSV finds an unexpected tag name. For example:
<html> <head> ... </head> <head> ... </head> <!-- head cannot appear here --> <body> ... </body> </html> </pre>
<html> <heed> ... </heed> <!-- typo --> <body> ... </body> </pre>
<html>
<head>
<meta ...>
<junk/> <!-- meta cannot have any children -->
This error is reported when the startElement callback is called.
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| BadTagName | back to summary |
|---|---|
| public BadTagName(String qn, String ns, String loc) | |
| BadTagName | back to summary |
|---|---|
| public BadTagName(StartTagInfo sti) | |
This type of errors indicate that the document contains PCDATA but it is not good. Here are typical examples of this error.
<html> <head> ... </head> ** invalid text ** <body> ... </body> </html>
<!-- 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.
| Modifier and Type | Field and Description |
|---|---|
| public final String | literal
The actual text that caused the error. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| literal | back to summary |
|---|---|
| public final String literal The actual text that caused the error. | |
| BadText | back to summary |
|---|---|
| public BadText(String _literal) | |
| BadText | back to summary |
|---|---|
| public BadText(StringBuffer _literal) | |
| Modifier and Type | Field and Description |
|---|---|
| public final String | |
| public final String | |
| public final String | qName
tag name information. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| localName | back to summary |
|---|---|
| public final String localName | |
| namespaceURI | back to summary |
|---|---|
| public final String namespaceURI | |
| qName | back to summary |
|---|---|
| public final String qName tag name information. | |
| ElementErrorInfo | back to summary |
|---|---|
| public ElementErrorInfo(String qn, String ns, String loc) | |
| ElementErrorInfo | back to summary |
|---|---|
| public ElementErrorInfo(StartTagInfo sti) | |
<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.)
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| IncompleteContentModel | back to summary |
|---|---|
| public IncompleteContentModel(String qn, String ns, String loc) | |
| IncompleteContentModel | back to summary |
|---|---|
| public IncompleteContentModel(StartTagInfo sti) | |
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? -->
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| MissingAttribute | back to summary |
|---|---|
| public MissingAttribute(String qn, String ns, String loc) | |
| MissingAttribute | back to summary |
|---|---|
| public MissingAttribute(StartTagInfo sti) | |