The class Structures_BibTex introduces a system to collect warnings that may happen during parsing. Warnings are things in the BibTex source which are not correct but do not cause the parser to fail. One example would be a double cite entry. These warnings should help to improve the quality of your BibTex code. Whether warnings are generated or not is controlled by the option validate. Per default warnings are generated. If you want to not generate warnings you should use the setOption() method like this.
Example 55-1. Switching off creation of warnings
|
The warnings are stored in an array called warnings which is public accessible. To check is a warning exists you can use the method hasWarning(). This method returns true if there are warnings and false otherwise.
Example 55-2. Checking for warnings
|
warning - Type of the warning
entry - The line that caused the warning
wholeentry - The whole entry in which the warning occurred
Example 55-3. Checking for warnings
|
The following Warnings are known:
WARNING_AT_IN_BRACES - A Value is delimited by Braces. Then inside a @ is not allowed.
WARNING_ESCAPED_DOUBLE_QUOTE_INSIDE_DOUBLE_QUOTES - A Value is delimited by double quotes. Then inside no escaped double quote is allowed.
WARNING_UNBALANCED_AMOUNT_OF_BRACES - The amount of braces inside a value is not equal (opening and closing). The parses fails if in the complete entry this amount is not correct. But if only on an entry it is not correct then this is only a warning. As a matter of fact of the parser does not fail but there is an unbalanced amount of braces in an entry this warning has to be generated something times two.
WARNING_MULTIPLE_ENTRIES - Every entry is identified by a unique string. This warning is created if there are at least two entries with the same identification.
WARNING_LINE_WAS_NOT_CONVERTED - This warning is created if during exporting (for example in RTF or HTML) one entry was ignored because of no matching data in the entry. At least one of the following entries have to exist in the entry to get converted: title, journal, year or authors.