public interface ParserCallback
Known subtypesAds, RSSService, DefaultHTMLCallback, HTMLCallback
A callback used to dispatch errors encountered while parsing XML resources
Fields
public static final int ERROR_TAG_NOT_SUPPORTED = 0 | Error code denoting that an unsupported tag was found in the XML |
public static final int ERROR_ATTRIBUTE_NOT_SUPPORTED = 1 | Error code denoting that an unsupported attribute was found in the XML |
public static final int ERROR_ATTIBUTE_VALUE_INVALID = 2 | Error code denoting that an invalid attribute value was found in the XML |
public static final int ERROR_NO_CLOSE_TAG = 3 | Error code denoting that a tag was not closed properly in the XML |
public static final int ERROR_UNRECOGNIZED_CHAR_ENTITY = 4 | Error code denoting that an invalid character entity was found A character entity is XML codes that start with an ampersand and end with semicolon and denote special/reserved chars |
public static final int ERROR_UNEXPECTED_TAG_CLOSING = 5 | Error code denoting that a tag was not closed prematurely |
public static final int ERROR_UNEXPECTED_CHARACTER = 6 | Error code denoting that the parser bumped into an unexpected character |
public static final int ERROR_MULTIPLE_ROOTS = 7 | Error code denoting that the document had more than one root element |
public static final int ERROR_NO_ROOTS = 8 | Error code denoting that the document had no root element at all (empty document or seriously malformed XML) |
public static final int ERROR_ENCODING = 9 | Error code denoting that the encoding the page needed according to its charset (usually specified in the content-type response header) is unsupported in the device |
Methods
public abstract boolean parsingError(int errorId, String tag, String attribute, String value, String description) | Called when encountering an error while parsing the XML document. |
Field details
ERROR_TAG_NOT_SUPPORTED
public static final int ERROR_TAG_NOT_SUPPORTED = 0Error code denoting that an unsupported tag was found in the XML
ERROR_ATTRIBUTE_NOT_SUPPORTED
public static final int ERROR_ATTRIBUTE_NOT_SUPPORTED = 1Error code denoting that an unsupported attribute was found in the XML
ERROR_ATTIBUTE_VALUE_INVALID
public static final int ERROR_ATTIBUTE_VALUE_INVALID = 2Error code denoting that an invalid attribute value was found in the XML
ERROR_NO_CLOSE_TAG
public static final int ERROR_NO_CLOSE_TAG = 3Error code denoting that a tag was not closed properly in the XML
ERROR_UNRECOGNIZED_CHAR_ENTITY
public static final int ERROR_UNRECOGNIZED_CHAR_ENTITY = 4Error code denoting that an invalid character entity was found
A character entity is XML codes that start with an ampersand and end with semicolon and denote special/reserved chars
ERROR_UNEXPECTED_TAG_CLOSING
public static final int ERROR_UNEXPECTED_TAG_CLOSING = 5Error code denoting that a tag was not closed prematurely
ERROR_UNEXPECTED_CHARACTER
public static final int ERROR_UNEXPECTED_CHARACTER = 6Error code denoting that the parser bumped into an unexpected character
ERROR_MULTIPLE_ROOTS
public static final int ERROR_MULTIPLE_ROOTS = 7Error code denoting that the document had more than one root element
ERROR_NO_ROOTS
public static final int ERROR_NO_ROOTS = 8Error code denoting that the document had no root element at all (empty document or seriously malformed XML)
ERROR_ENCODING
public static final int ERROR_ENCODING = 9Error code denoting that the encoding the page needed according to its charset (usually specified in the content-type response header) is unsupported in the device
Method details
parsingError
public abstract boolean parsingError(int errorId, String tag, String attribute, String value, String description)Called when encountering an error while parsing the XML document.
When implementing this, the developer should return true if the error should be ignored and the document needs to be further parsed, or false to stop parsing and issue an error to the user
Note that this method is always called NOT on the EDT thread.
Parameters
errorIdint- The error ID, one of the ERROR_* constants
tagString- The tag in which the error occured (Can be null for non-tag related errors)
attributeString- The attribute in which the error occured (Can be null for non-attribute related errors)
valueString- The value in which the error occured (Can be null for non-value related errors)
descriptionString- A verbal description of the error
Returns
true to continue parsing, false to stop