← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1095889 into lp:zorba

 

Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-1095889 into lp:zorba.

Commit message:
Now using libxml's xmlStructuredErrorFunc to format error messages ourselves.

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #1095889 in Zorba: "Improve error message for xml-parsing error"
  https://bugs.launchpad.net/zorba/+bug/1095889

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1095889/+merge/143823

Now using libxml's xmlStructuredErrorFunc to format error messages ourselves.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1095889/+merge/143823
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-01-14 09:46:44 +0000
+++ ChangeLog	2013-01-18 04:42:26 +0000
@@ -1,5 +1,10 @@
 Zorba - The XQuery Processor
 
+version 2.9
+
+Bug Fixes/Other Changes:
+  * Fixed bug #1095889 (Improve error message for xml-parsing error).
+
 
 version 2.8
 
@@ -31,27 +36,28 @@
   * Fixed iteration over the components of a window clause; this improves static
     type computation of expressions referencing window vars.
   * No need to cast xs:untypedAtomic to xs:string in order-by expression.
-  * Convert LET variables whose domain sequence has exactly one item to FOR vars.
+  * Convert LET variables whose domain sequence has exactly one item to FOR
+    vars.
 
 Bug Fixes/Other Changes:
   * Fixed bug #949064  (faulty QName should be printed in the error message)
   * Fixed bug #1072644 (broken parser error location)
   * Fixed bug #868640 (Node lifetime is shorter than expected due to let
-      variable inlining)
+    variable inlining)
   * Fixed bugs #1081626 (Segmentation fault in a side-effecting FLWOR),
-      #1079488 (streaming segfault)
+    #1079488 (streaming segfault)
   * Fixed bug #1062093 (bug in var reference iterators with an associated
-      position that is negative)
+    position that is negative)
   * Fixed bug #1073978 (FOTS: option default ns not supported)
   * Fixed bug #1061222 (bad message for errors in index key type declaration)
   * Fixed bug #1065175 (preceding::node()[1] returns wrong results)
   * Fixed bug #1065321 (following:text() doesn't return results in doc order)
   * Fixed bug #1067706 (wrong const folding in mutually recursive udfs)
-  * Fixed bug #1021492 (while computing the "sources" of a prolog var, skip
-      any var-setting exprs that appear in non-used (and non-optimized) functions).
+  * Fixed bug #1021492 (while computing the "sources" of a prolog var, skip any
+    var-setting exprs that appear in non-used (and non-optimized) functions).
   * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)
   * Fixed bug #992304 (Compiling library modules could load data from wrong
-    source)
+    source).
   * Fixed bug #1043294 (XQST0036 not used in XQuery 3.0).
   * Fixed bug in castable expr when the target type is xs:QName.
   * Fixed bug in testing if a sequence type is subtype of node(xs:untyped)

=== modified file 'include/zorba/internal/diagnostic.h'
--- include/zorba/internal/diagnostic.h	2012-11-30 23:09:09 +0000
+++ include/zorba/internal/diagnostic.h	2013-01-18 04:42:26 +0000
@@ -251,19 +251,45 @@
   }
 
   /**
-   * Substitutes substrings of the given string.  There are two forms:
+   * Substitutes substrings of the given string.  Substitutions are in three
+   * forms:
    *
    * - <code>$</code><em>i</em>
    * - <code>${</code><em>chars i chars</em><code>}</code>
-   *
-   * where <em>i</em> is an integer in the range <code>[1,9]</code>
-   * and <em>chars</em> are any characters except <code>[1-9}]</code>.
-   *
-   * The second form elides the addition characacters if the value of the
-   * <em>ith</em> parameter is empty.  For example, <code>${"1"}</code> will
-   * substitute the value of the 1st parameter quoted if non-empty; if empty,
-   * the entire substitution set of characters (everything from the
-   * <code>$</code> to the <code>}</code>) will be elided.
+   * - <code>$</code><em>i</em><code>?</code><em>then</em>[<code>:</code><em>else</em>]
+   *
+   * where \e i is a digit in the range <code>[1,9]</code> and refers to the
+   * value of the \e ith parameter, \e chars may be any characters except
+   * <code>[1-9}]</code>, and \e then and \e else are of one of the two forms:
+   *
+   *  - <em>j</em>
+   *  - <code>{</code><em>chars j chars k chars ...</em><code>}</code>
+   *
+   * The first substitution form replaces <code>$</code><em>i</em> with the
+   * value of the \e ith parameter.
+   *
+   * The second form replaces everything from the \c $ to the \c } with the
+   * contents of the \c {} where \e i is replaced with the value of the \e ith
+   * parameter.  However, if the value is empty, then everything from the \c $
+   * to the \c } is instead erased.
+   *
+   * For example, <code>${"1": }</code> will substitute the value of the 1st
+   * parameter quoted followed by a \c : and a space if non-empty; if empty,
+   * then everything from the \c $ to the \c } will instead be erased.
+   *
+   * The third form tests the value of the \c ith parameter: if non-empty, then
+   * the \e then portion is substituted; if empty, then the \e else portion is.
+   * Both the \e then and \e else portions can be either a digit in the range
+   * [1,9] or \e chars enclosed by \c {}.  The \c {} here can contain multiple
+   * parameter indicies.  If at least one is non-empty, then the substitution
+   * for the portion will be done; if all are empty, then everything for the
+   * portion will be erased.
+   *
+   * Substitution is performed by making at most 9 passes over the string, one
+   * pass per parameter starting at 1.  Substitutions may themselves have
+   * further substitutions, but, due to the way that substitution is performed,
+   * should only refer to parameters having higher digits.  (Digits less than
+   * or equal to the current one will not be substituted.)
    *
    * @param s The string to perform the substitutions on.
    */
@@ -273,6 +299,9 @@
   params_type params_;
 
   value_type lookup_param( size_type i ) const;
+  bool then_else( bool, value_type const&, value_type::size_type*,
+                  value_type* ) const;
+  size_type to_index( value_type::value_type ) const;
 };
 
 ///////////////////////////////////////////////////////////////////////////////

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2013-01-11 17:37:08 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2013-01-18 04:42:26 +0000
@@ -912,6 +912,8 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED;
 
+extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0007_LOADER_PARSING_WARNING;
+
 } // namespace zwarn
 } // namespace zorba
 #endif /* ZORBA_DIAGNOSTIC_LIST_API_H */

=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq	2012-09-19 21:16:15 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq	2013-01-18 04:42:26 +0000
@@ -72,4 +72,8 @@
  : is annotated as sequential or nondeterministic.
  : 
 :)
-declare variable $zwarn:ZWST0006 as xs:QName := fn:QName($zwarn:NS, "zwarn:ZWST0006");
\ No newline at end of file
+declare variable $zwarn:ZWST0006 as xs:QName := fn:QName($zwarn:NS, "zwarn:ZWST0006");
+
+(:~
+:)
+declare variable $zwarn:ZWST0007 as xs:QName := fn:QName($zwarn:NS, "zwarn:ZWST0007");
\ No newline at end of file

=== modified file 'src/diagnostics/diagnostic.cpp'
--- src/diagnostics/diagnostic.cpp	2012-12-31 23:19:53 +0000
+++ src/diagnostics/diagnostic.cpp	2013-01-18 04:42:26 +0000
@@ -166,6 +166,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+#define case_123456789 \
+  case '1': case '2': case '3': case '4': case '5': \
+  case '6': case '7': case '8': case '9'
+
 namespace internal {
 
 SystemDiagnosticBase::map_type& SystemDiagnosticBase::get_map() {
@@ -192,13 +196,21 @@
   return param;
 }
 
+inline
+parameters::size_type parameters::to_index( value_type::value_type c ) const {
+  return static_cast<size_type>( c - '0' );
+}
+
 void parameters::substitute( value_type *s ) const {
+  value_type param, replacement;
+
   for ( size_type i = 1; i <= 9; ++i ) {
     size_type dollar_pos = value_type::npos;
+    bool found_param = false;
     bool got_lbrace = false;
-    value_type param, replacement;
+    bool replace;
 
-    for ( size_type pos = 0; pos < s->size(); ++pos ) {
+    for ( value_type::size_type pos = 0; pos < s->size(); ++pos ) {
       char const c = s->at( pos );
       if ( dollar_pos != value_type::npos ) {
 
@@ -207,26 +219,20 @@
         //
         if ( got_lbrace ) {
           switch ( c ) {
-            case '1': case '2': case '3': case '4': case '5':
-            case '6': case '7': case '8': case '9':
-              if ( c - '0' == static_cast<int>( i ) ) {
+            case_123456789:
+              if ( to_index( c ) == i ) {
+                if ( found_param )
+                  throw invalid_argument( "multiple params within { }" );
+                found_param = true;
                 param = lookup_param( i );
                 replacement += param;
               } else
                 dollar_pos = value_type::npos;
               break;
-            case '}': {
-              size_type const len = pos - dollar_pos + 1;
-              if ( param.empty() )
-                s->erase( dollar_pos, len );
-              else {
-                s->replace( dollar_pos, len, replacement );
-                pos = dollar_pos + replacement.length();
-              }
-              dollar_pos = value_type::npos;
+            case '}':
               got_lbrace = false;
-              break;
-            }
+              replace = !param.empty();
+              goto replace_or_erase;
             default:
               replacement += c;
           }
@@ -235,23 +241,53 @@
 
         //
         // $i case
+        // $i?j:k case
         //
         switch ( c ) {
           case '{':
             got_lbrace = true;
             break;
-          case '1': case '2': case '3': case '4': case '5':
-          case '6': case '7': case '8': case '9':
-            if ( c - '0' == static_cast<int>( i ) ) {
-              replacement = lookup_param( i );
-              s->replace( dollar_pos, 2, replacement );
-              pos = dollar_pos + replacement.length();
-            }
+          case_123456789:
+            if ( to_index( c ) == i ) {
+              param = lookup_param( i );
+
+              value_type::size_type pos2 = pos;
+              if ( ++pos2 < s->size() && s->at( pos2 ) == '?' &&
+                   ++pos2 < s->size() ) {
+                //
+                // The i?j:k case....
+                //
+                pos = pos2;
+                replace = then_else( !param.empty(), *s, &pos, &replacement );
+                pos2 = pos;
+                if ( ++pos2 < s->size() && s->at( pos2 ) == ':' ) {
+                  pos = pos2 + 1;
+                  replace =  then_else( param.empty(), *s, &pos, &replacement )
+                          || replace;
+                }
+                goto replace_or_erase;
+              } else {
+                s->replace( dollar_pos, 2, param );
+                pos = dollar_pos + param.length();
+              }
+            } // if ( to_index( c ) ...
             // no break;
           default:
             dollar_pos = value_type::npos;
+        } // switch
+
+        continue;
+
+replace_or_erase:
+        value_type::size_type const replace_or_erase_len = pos - dollar_pos + 1;
+        if ( replace ) {
+          s->replace( dollar_pos, replace_or_erase_len, replacement );
+          pos = dollar_pos + replacement.length() - 1;
+        } else {
+          s->erase( dollar_pos, replace_or_erase_len );
+          pos = dollar_pos - 1;
         }
-
+        dollar_pos = value_type::npos;
         continue;
       } // if ( dollar_pos ...
 
@@ -264,6 +300,52 @@
   } // for ( ... i ...
 }
 
+bool parameters::then_else( bool expr, value_type const &s,
+                            value_type::size_type *pos,
+                            value_type *replacement ) const {
+  value_type::value_type c = s[ *pos ];
+  bool found_param = false, not_empty = false;
+
+  switch ( c ) {
+    case_123456789:
+      found_param = true;
+      if ( expr ) {
+        *replacement = lookup_param( to_index( c ) );
+        not_empty = !replacement->empty();
+      }
+      break;
+    case '{':
+      while ( ++*pos < s.size() ) {
+        c = s[ *pos ];
+        switch ( c ) {
+          case_123456789:
+            found_param = true;
+            if ( expr ) {
+              value_type const param = lookup_param( to_index( c ) );
+              not_empty = !param.empty() || not_empty;
+              *replacement += param;
+            }
+            break;
+          case '}':
+            goto done;
+          default:
+            *replacement += c;
+        } // switch
+      } // while
+      throw invalid_argument( "'}' expected for ?:" );
+    default:
+      throw invalid_argument(
+        BUILD_STRING(
+          '\'', c, "': invalid character after '", (expr ? '?' : ':'),
+          "' (one of [1-9{] expected)"
+        )
+      );
+  } // switch
+
+done:
+  return !found_param || not_empty;
+}
+
 } // namespace diagnostic
 } // namespace internal
 

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-01-11 17:37:08 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-01-18 04:42:26 +0000
@@ -15,6 +15,48 @@
  -->
 
 <!--
+ !  Substitutes substrings of the given string.  Substitutions are in three
+ !  forms:
+ ! 
+ !  - $i
+ !  - ${<chars> i <chars>}
+ !  - $i?<then>[:<else>]
+ ! 
+ !  where i is a digit in the range [1,9] and refers to the value of the ith
+ !  parameter, <chars> may be any characters except [1-9}], and <then> and
+ !  <else> are of one of the two forms:
+ ! 
+ !   - j
+ !   - {<chars> j <chars> [k <chars>...]}
+ ! 
+ !  The first substitution form replaces $i with the value of the ith
+ !  parameter.
+ ! 
+ !  The second form replaces everything from the $ to the } with the contents
+ !  of the {} where i is replaced with the value of the ith parameter.
+ !  However, if the value is empty, then everything from the $ to the } is
+ !  instead erased.
+ ! 
+ !  For example, ${"1": } will substitute the value of the 1st parameter quoted
+ !  followed by a : and a space if non-empty; if empty, then everything from
+ !  the $ to the } will instead be erased.
+ ! 
+ !  The third form tests the value of the ith parameter: if non-empty, then the
+ !  <then> portion is substituted; if empty, then the <else> portion is.  Both
+ !  the <then> and <else> portions can be either a digit in the range [1,9] or
+ !  <chars> enclosed by {}.  The {} here can contain multiple parameter
+ !  indicies.  If at least one is non-empty, then the substitution for the
+ !  portion will be done; if all are empty, then everything for the portion
+ !  will be erased.
+ ! 
+ !  Substitution is performed by making at most 9 passes over the string, one
+ !  pass per parameter starting at 1.  Substitutions may themselves have
+ !  further substitutions, but, due to the way that substitution is performed,
+ !  should only refer to parameters having higher digits.  (Digits less than or
+ !  equal to the current one will not be substituted.)
+ -->
+
+<!--
  ! Please use the following convention for sub-message keys.
  !
  ! If a sub-message key has at least one $n number in it (where 'n' is [1-9]),
@@ -2635,7 +2677,7 @@
     </diagnostic>
 
     <diagnostic code="ZSTR0021" name="LOADER_PARSING_ERROR">
-      <value>loader parsing error${: 1}</value>
+      <value>"$1":$2,$3: loader parsing error${: 4}</value>
     </diagnostic>
 
     <diagnostic code="ZSTR0030" name="NODEID_ERROR">
@@ -3059,6 +3101,10 @@
       <value>"$1": function caching might not give the intended result because the function is declared as $2</value>
     </diagnostic>
 
+    <diagnostic code="ZWST0007" name="LOADER_PARSING_WARNING">
+      <value>"$1":$2,$3: loader parsing warning${: 4}</value>
+    </diagnostic>
+
   </namespace>
 
   <!--////////// Subvalues /////////////////////////////////////////////////-->
@@ -4198,6 +4244,625 @@
       <value>annotation</value>
     </entry>
 
+    <!--////////// libxml2 Errors //////////////////////////////////////////-->
+
+    <entry key="libxml_ERR_1"> <!-- XML_ERR_INTERNAL_ERROR -->
+      <value>libxml internal error${: 9}</value>
+    </entry>
+
+    <entry key="libxml_ERR_2"> <!-- XML_ERR_NO_MEMORY -->
+      <value>out of memory${: 9}</value>
+    </entry>
+
+    <!-- 3: XML_ERR_DOCUMENT_START not used -->
+
+    <entry key="libxml_ERR_4"> <!-- XML_ERR_DOCUMENT_EMPTY -->
+      <value>empty XML document ('&lt;' expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_5"> <!-- XML_ERR_DOCUMENT_END -->
+      <value>extra content at end of XML document</value>
+    </entry>
+
+    <entry key="libxml_ERR_6"> <!-- XML_ERR_INVALID_HEX_CHARREF -->
+      <value>${"5": }invalid hexedecimal value for character reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_7"> <!-- XML_ERR_INVALID_DEC_CHARREF -->
+      <value>${"5": }invalid decimal value for character reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_8"> <!-- XML_ERR_INVALID_CHARREF -->
+      <value>${"5": }invalid value for character reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_9"> <!-- XML_ERR_INVALID_CHAR -->
+      <value>${"&amp;#8;": }invalid XML character value</value>
+    </entry>
+
+    <!-- 10: XML_ERR_CHARREF_AT_EOF not used -->
+    <!-- 11: XML_ERR_CHARREF_IN_PROLOG not used -->
+    <!-- 12: XML_ERR_CHARREF_IN_EPILOG not used -->
+    <!-- 13: XML_ERR_CHARREF_IN_DTD not used -->
+    <!-- 14: XML_ERR_ENTITYREF_AT_EOF not used -->
+    <!-- 15: XML_ERR_ENTITYREF_IN_PROLOG not used -->
+    <!-- 16: XML_ERR_ENTITYREF_IN_EPILOG not used -->
+    <!-- 17: XML_ERR_ENTITYREF_IN_DTD not used -->
+
+    <entry key="libxml_ERR_18"> <!-- XML_ERR_PEREF_AT_EOF -->
+      <value>PE reference at end of XML document</value>
+    </entry>
+
+    <entry key="libxml_ERR_19"> <!-- XML_ERR_PEREF_IN_PROLOG -->
+      <value>PE reference in prolog</value>
+    </entry>
+
+    <entry key="libxml_ERR_20"> <!-- XML_ERR_PEREF_IN_EPILOG -->
+      <value>PE reference in epilog</value>
+    </entry>
+
+    <entry key="libxml_ERR_21"> <!-- XML_ERR_PEREF_IN_INT_SUBSET -->
+      <value>PE reference forbidden within markup declaration in internal subset</value>
+    </entry>
+
+    <!-- 22: XML_ERR_ENTITYREF_NO_NAME not used -->
+
+    <entry key="libxml_ERR_23"> <!-- XML_ERR_ENTITYREF_SEMICOL_MISSING -->
+      <value>';' expected at end of character entity reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_24"> <!-- XML_ERR_PEREF_NO_NAME -->
+      <value>PE reference: no name</value>
+    </entry>
+
+    <entry key="libxml_ERR_25"> <!-- XML_ERR_PEREF_SEMICOL_MISSING -->
+      <value>PE reference: ';' expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_26"> <!-- XML_ERR_UNDECLARED_ENTITY -->
+      <value>${"5": }undeclared entity reference</value>
+    </entry>
+
+    <entry key="libxml_WAR_27"> <!-- XML_WAR_UNDECLARED_ENTITY -->
+      <value>${"5": }undeclared entity reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_28"> <!-- XML_ERR_UNPARSED_ENTITY -->
+      <value>${"5": }entity reference to unparsed entity</value>
+    </entry>
+
+    <entry key="libxml_ERR_29"> <!-- XML_ERR_ENTITY_IS_EXTERNAL -->
+      <value>${"5": }external entity referenced by attribute</value>
+    </entry>
+
+    <entry key="libxml_ERR_30"> <!-- XML_ERR_ENTITY_IS_PARAMETER -->
+      <value>${"5": }parameter entity attempted reference</value>
+    </entry>
+
+    <entry key="libxml_ERR_31"> <!-- XML_ERR_UNKNOWN_ENCODING -->
+      <value>${"5": }unknown character encoding</value>
+    </entry>
+
+    <entry key="libxml_ERR_32"> <!-- XML_ERR_UNSUPPORTED_ENCODING -->
+      <value>${"5": }unsupported character encoding</value>
+    </entry>
+
+    <entry key="libxml_ERR_33"> <!-- XML_ERR_STRING_NOT_STARTED -->
+      <value>string not started (' or " expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_34"> <!-- XML_ERR_STRING_NOT_CLOSED -->
+      <value>string not ended (' or " expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_35"> <!-- XML_ERR_NS_DECL_ERROR -->
+      <value>${"5": }invalid namespace declaration</value>
+    </entry>
+
+    <entry key="libxml_ERR_36"> <!-- XML_ERR_ENTITY_NOT_STARTED -->
+      <value>entity value not started (' or " expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_37"> <!-- XML_ERR_ENTITY_NOT_FINISHED -->
+      <value>${"5": }entity value not ended (' or " expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_38"> <!-- XML_ERR_LT_IN_ATTRIBUTE -->
+      <value>unescaped '&lt;' not allowed in attribute values</value>
+    </entry>
+
+    <entry key="libxml_ERR_39"> <!-- XML_ERR_ATTRIBUTE_NOT_STARTED -->
+      <value>attribute value not started (' or " expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_40"> <!-- XML_ERR_ATTRIBUTE_NOT_FINISHED -->
+      <value>attribute value not ended (' or " expected) or too big</value>
+    </entry>
+
+    <entry key="libxml_ERR_41"> <!-- XML_ERR_ATTRIBUTE_WITHOUT_VALUE -->
+      <value>${"5": }attribute must have a value</value>
+    </entry>
+
+    <entry key="libxml_ERR_42"> <!-- XML_ERR_ATTRIBUTE_REDEFINED -->
+      <value>"$6?{5:}$6?6:5" attribute redefined</value>
+    </entry>
+
+    <entry key="libxml_ERR_43"> <!-- XML_ERR_LITERAL_NOT_STARTED -->
+      <value>' or " expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_44"> <!-- XML_ERR_LITERAL_NOT_FINISHED -->
+      <value>' or " expected to end System or Public ID literal</value>
+    </entry>
+
+    <entry key="libxml_ERR_45"> <!-- XML_ERR_COMMENT_NOT_FINISHED -->
+      <value>comment not ended ("-->" expected) or too big</value>
+    </entry>
+
+    <entry key="libxml_ERR_46"> <!-- XML_ERR_PI_NOT_STARTED -->
+      <value>processing instruction not started correctly (missing target name?)</value>
+    </entry>
+
+    <entry key="libxml_ERR_47"> <!-- XML_ERR_PI_NOT_FINISHED -->
+      <value>processing instruction "$5" not ended ("?>" expected) or too big</value>
+    </entry>
+
+    <entry key="libxml_ERR_48"> <!-- XML_ERR_NOTATION_NOT_STARTED -->
+      <value>notation name expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_49"> <!-- XML_ERR_NOTATION_NOT_FINISHED -->
+      <value>'>' expected to end notation declaration</value>
+    </entry>
+
+    <entry key="libxml_ERR_50"> <!-- XML_ERR_ATTLIST_NOT_STARTED -->
+      <value>'(' expected to start ATTLIST enumeration</value>
+    </entry>
+
+    <entry key="libxml_ERR_51"> <!-- XML_ERR_ATTLIST_NOT_FINISHED -->
+      <value>')' expected to end ATTLIST enumeration</value>
+    </entry>
+
+    <entry key="libxml_ERR_52"> <!-- XML_ERR_MIXED_NOT_STARTED -->
+      <value>'|' or ")*" expected for mixed content declaration</value>
+    </entry>
+
+    <!-- 53: XML_ERR_MIXED_NOT_FINISHED not used -->
+
+    <entry key="libxml_ERR_54"> <!-- XML_ERR_ELEMCONTENT_NOT_STARTED -->
+      <value>$5?5:{name or} '(' expected for content declaration</value>
+    </entry>
+
+    <entry key="libxml_ERR_55"> <!-- XML_ERR_ELEMCONTENT_NOT_FINISHED -->
+      <value>',', '|', or ')' expected in content declaration${ or depth 8 too deep}</value>
+    </entry>
+
+    <entry key="libxml_ERR_56"> <!-- XML_ERR_XMLDECL_NOT_STARTED -->
+      <value>"&lt;?xml" required to start XML declaration</value>
+    </entry>
+
+    <entry key="libxml_ERR_57"> <!-- XML_ERR_XMLDECL_NOT_FINISHED -->
+      <value>"?>" expected to end XML declaration</value>
+    </entry>
+
+    <!-- 58: XML_ERR_CONDSEC_NOT_STARTED not used -->
+
+    <entry key="libxml_ERR_59"> <!-- XML_ERR_CONDSEC_NOT_FINISHED -->
+      <value>XML conditional section not ended</value>
+    </entry>
+
+    <entry key="libxml_ERR_60"> <!-- XML_ERR_EXT_SUBSET_NOT_FINISHED -->
+      <value>content error in external subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_61"> <!-- XML_ERR_DOCTYPE_NOT_FINISHED -->
+      <value>DOCTYPE improperly ended</value>
+    </entry>
+
+    <entry key="libxml_ERR_62"> <!-- XML_ERR_MISPLACED_CDATA_END -->
+      <value>"]]&gt;" not allowed in content</value>
+    </entry>
+
+    <entry key="libxml_ERR_63"> <!-- XML_ERR_CDATA_NOT_FINISHED -->
+      <value>CDATA not ended ("]]&gt;" expected) or too big</value>
+    </entry>
+
+    <entry key="libxml_ERR_64"> <!-- XML_ERR_RESERVED_XML_NAME -->
+      <value>"xml": reserved XML prefix</value>
+    </entry>
+
+    <entry key="libxml_ERR_65"> <!-- XML_ERR_SPACE_REQUIRED -->
+      <value>space required here</value>
+    </entry>
+
+    <entry key="libxml_ERR_66"> <!-- XML_ERR_SEPARATOR_REQUIRED -->
+      <value>'$8' expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_67"> <!-- XML_ERR_NMTOKEN_REQUIRED -->
+      <value>NMTOKEN expected in ATTLIST enumeration</value>
+    </entry>
+
+    <entry key="libxml_ERR_68"> <!-- XML_ERR_NAME_REQUIRED -->
+      <value>name expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_69"> <!-- XML_ERR_PCDATA_REQUIRED -->
+      <value>"#PCDATA" expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_70"> <!-- XML_ERR_URI_REQUIRED -->
+      <value>URI expected for SYSTEM or PUBLIC</value>
+    </entry>
+
+    <entry key="libxml_ERR_71"> <!-- XML_ERR_PUBID_REQUIRED -->
+      <value>PUBLIC identifier expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_72"> <!-- XML_ERR_LT_REQUIRED -->
+      <value>'&lt;' expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_73"> <!-- XML_ERR_GT_REQUIRED -->
+      <value>'>' expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_74"> <!-- XML_ERR_LTSLASH_REQUIRED -->
+      <value>"&lt;/" expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_75"> <!-- XML_ERR_EQUAL_REQUIRED -->
+      <value>'=' expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_76"> <!-- XML_ERR_TAG_NAME_MISMATCH -->
+      <value>"&lt;/$6>": closing tag mismatch for "&lt;$5>"</value>
+    </entry>
+
+    <entry key="libxml_ERR_77"> <!-- XML_ERR_TAG_NOT_FINISHED -->
+      <value>"$5": premature end of content for tag starting on line $8</value>
+    </entry>
+
+    <entry key="libxml_ERR_78"> <!-- XML_ERR_STANDALONE_VALUE -->
+      <value>"yes" or "no" expected for "standalone"</value>
+    </entry>
+
+    <entry key="libxml_ERR_79"> <!-- XML_ERR_ENCODING_NAME -->
+      <value>invalid XML encoding name</value>
+    </entry>
+
+    <entry key="libxml_ERR_80"> <!-- XML_ERR_HYPHEN_IN_COMMENT -->
+      <value>"--" forbidden within XML comment</value>
+    </entry>
+
+    <entry key="libxml_ERR_81"> <!-- XML_ERR_INVALID_ENCODING -->
+      <value>document labelled UTF-16 but has UTF-8 content</value>
+    </entry>
+
+    <!-- 82: XML_ERR_EXT_ENTITY_STANDALONE not used -->
+
+    <entry key="libxml_ERR_83"> <!-- XML_ERR_CONDSEC_INVALID -->
+      <value>'[' expected in XML condition section</value>
+    </entry>
+
+    <entry key="libxml_ERR_84"> <!-- XML_ERR_VALUE_REQUIRED -->
+      <value>entity value expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_85"> <!-- XML_ERR_NOT_WELL_BALANCED -->
+      <value>XML chunk is not well-balanced</value>
+    </entry>
+
+    <entry key="libxml_ERR_86"> <!-- XML_ERR_EXTRA_CONTENT -->
+      <value>extra content at end of well-balanced chunk</value>
+    </entry>
+
+    <entry key="libxml_ERR_87"> <!-- XML_ERR_ENTITY_CHAR_ERROR -->
+      <value>'$8' forbidden except for entity references</value>
+    </entry>
+
+    <entry key="libxml_ERR_88"> <!-- XML_ERR_ENTITY_PE_INTERNAL -->
+      <value>invalid entity type</value>
+    </entry>
+
+    <entry key="libxml_ERR_89"> <!-- XML_ERR_ENTITY_LOOP -->
+      <value>entity reference loop</value>
+    </entry>
+
+    <entry key="libxml_ERR_90"> <!-- XML_ERR_ENTITY_BOUNDARY -->
+      <value>declaration must start and end in the same entity</value>
+    </entry>
+
+    <entry key="libxml_ERR_91"> <!-- XML_ERR_INVALID_URI -->
+      <value>"$5": invalid URI</value>
+    </entry>
+
+    <entry key="libxml_ERR_92"> <!-- XML_ERR_URI_FRAGMENT -->
+      <value>URI fragment not allowed</value>
+    </entry>
+
+    <entry key="libxml_WAR_93"> <!-- XML_WAR_CATALOG_PI -->
+      <value>"$5": catalog processing instruction syntax error</value>
+    </entry>
+
+    <entry key="libxml_ERR_94"> <!-- XML_ERR_NO_DTD -->
+      <value>validation failed: no DTD found</value>
+    </entry>
+
+    <entry key="libxml_ERR_95"> <!-- XML_ERR_CONDSEC_INVALID_KEYWORD -->
+      <value>"IGNORE" or "INCLUDE" expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_96"> <!-- XML_ERR_VERSION_MISSING -->
+      <value>XML version expected</value>
+    </entry>
+
+    <entry key="libxml_WAR_97"> <!-- XML_WAR_UNKNOWN_VERSION -->
+      <value>"$5": unsupported XML version</value>
+    </entry>
+
+    <entry key="libxml_WAR_98"> <!-- XML_WAR_LANG_VALUE -->
+      <value>"$5": malformed xml:lang value</value>
+    </entry>
+
+    <entry key="libxml_WAR_99"> <!-- XML_WAR_NS_URI -->
+      <value>xmlns$6?{:5}: URI "$6?6:5": invalid URI</value>
+    </entry>
+
+    <entry key="libxml_WAR_100"> <!-- XML_WAR_NS_URI_RELATIVE -->
+      <value>xmlns$6?{:5}: URI "$6?6:5": invalid URI</value>
+    </entry>
+
+    <entry key="libxml_ERR_101"> <!-- XML_ERR_MISSING_ENCODING -->
+      <value>encoding expected in text declaration</value>
+    </entry>
+
+    <entry key="libxml_WAR_102"> <!-- XML_WAR_SPACE_VALUE -->
+      <value>"$5": invalid value for "xml:space"; either "default" or "preserve" expected</value>
+    </entry>
+
+    <entry key="libxml_ERR_103"> <!-- XML_ERR_NOT_STANDALONE -->
+      <value>"$5": entity marked standalone but requires external subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_104"> <!-- XML_ERR_ENTITY_PROCESSING -->
+      <value>"$5": failed to process entity or called while not in subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_105"> <!-- XML_ERR_NOTATION_PROCESSING -->
+      <value>"$5": external or public ID missing or called while not in subset</value>
+    </entry>
+
+    <entry key="libxml_WAR_106"> <!-- XML_WAR_NS_COLUMN -->
+      <value>"$5": avoid attribute ending with ':'</value>
+    </entry>
+
+    <entry key="libxml_WAR_107"> <!-- XML_WAR_ENTITY_REDEFINED -->
+      <value>"$5": entity already defined in the internal subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_108"> <!-- XML_ERR_UNKNOWN_VERSION -->
+      <value>"$5": unsupprted XML version</value>
+    </entry>
+
+    <entry key="libxml_ERR_109"> <!-- XML_ERR_VERSION_MISMATCH -->
+      <value>document/entity version mismatch</value>
+    </entry>
+
+    <entry key="libxml_ERR_110"> <!-- XML_ERR_NAME_TOO_LONG -->
+      <value>$5 too long (use XML_PARSE_HUGE option)</value>
+    </entry>
+
+    <entry key="libxml_ERR_200"> <!-- XML_NS_ERR_XML_NAMESPACE -->
+      <value>${"5": }invalid namespace or prefix</value>
+    </entry>
+
+    <entry key="libxml_ERR_201"> <!-- XML_NS_ERR_UNDEFINED_NAMESPACE -->
+      <value>${"5": }namespace prefix${ for "7?6"}${ on "7?7:6"} not defined</value>
+    </entry>
+
+    <entry key="libxml_ERR_202"> <!-- XML_NS_ERR_QNAME -->
+      <value>"$5${:6}": invalid XML QName</value>
+    </entry>
+
+    <entry key="libxml_ERR_203"> <!-- XML_NS_ERR_ATTRIBUTE_REDEFINED -->
+      <value>"$5": attribute in namespace "$6" redefined</value>
+    </entry>
+
+    <entry key="libxml_ERR_204"> <!-- XML_NS_ERR_EMPTY -->
+      <value>empty namespace for prefix "$5"</value>
+    </entry>
+
+    <entry key="libxml_ERR_205"> <!-- XML_NS_ERR_COLON -->
+      <value>"$5": colon is forbidden in entity, notation, and processing instruction names</value>
+    </entry>
+
+    <entry key="libxml_ERR_500"> <!-- XML_DTD_ATTRIBUTE_DEFAULT -->
+      <!--
+       ! We can't do better here since libxml uses puts different things in the
+       ! positional parameters.
+       !-->
+      <value>"$5": invalid attribute value</value>
+    </entry>
+
+    <entry key="libxml_ERR_501"> <!-- XML_DTD_ATTRIBUTE_REDEFINED -->
+      <value>"$5": attribute of element "$6" already defined</value>
+    </entry>
+
+    <entry key="libxml_ERR_502"> <!-- XML_DTD_ATTRIBUTE_VALUE -->
+      <!--
+       ! We can't do better here since libxml uses puts different things in the
+       ! positional parameters.
+       !-->
+      <value>"$5": invalid attribute value</value>
+    </entry>
+
+    <entry key="libxml_ERR_503"> <!-- XML_DTD_CONTENT_ERROR -->
+      <value>"$5": defintion has duplicate references to "$6"</value>
+    </entry>
+
+    <entry key="libxml_ERR_504"> <!-- XML_DTD_CONTENT_MODEL -->
+      <!--
+       ! We can't do better here since libxml uses puts different things in the
+       ! positional parameters.
+       !-->
+      <value>${"5:" }element content does not follow DTD</value>
+    </entry>
+
+    <entry key="libxml_ERR_505"> <!-- XML_DTD_CONTENT_NOT_DETERMINIST -->
+      <value>"$5": content model is not deteministic</value>
+    </entry>
+
+    <entry key="libxml_ERR_506"> <!-- XML_DTD_DIFFERENT_PREFIX -->
+      <value>element "$5" required attribute "$6:$7" has different prefix</value>
+    </entry>
+
+    <entry key="libxml_ERR_507"> <!-- XML_DTD_ELEM_DEFAULT_NAMESPACE -->
+      <value>"$5": element namespace name for default namespace does not match DTD</value>
+    </entry>
+
+    <entry key="libxml_ERR_508"> <!-- XML_DTD_ELEM_NAMESPACE -->
+      <!--
+       ! We can't do better here since libxml uses puts different things in the
+       ! positional parameters.
+       !-->
+      <value>"$7?6:5": invalid attribute value or element namespace name does not match DTD</value>
+    </entry>
+
+    <entry key="libxml_ERR_509"> <!-- XML_DTD_ELEM_REDEFINED -->
+      <value>"$5": element redefined</value>
+    </entry>
+
+    <entry key="libxml_ERR_510"> <!-- XML_DTD_EMPTY_NOTATION -->
+      <value>"$5": notation attribute declared "EMPTY" for element "$6"</value>
+    </entry>
+
+    <entry key="libxml_ERR_511"> <!-- XML_DTD_ENTITY_TYPE -->
+      <value>"$5": ENTITY attribute references an entity "$6" of wrong type</value>
+    </entry>
+
+    <entry key="libxml_ERR_512"> <!-- XML_DTD_ID_FIXED -->
+      <value>"$5": invalid ID attribute of "$6" ("#IMPLIED" or "#REQUIRED" expected)</value>
+    </entry>
+
+    <entry key="libxml_ERR_513"> <!-- XML_DTD_ID_REDEFINED -->
+      <value>"$5": ID already defined</value>
+    </entry>
+
+    <entry key="libxml_ERR_514"> <!-- XML_DTD_ID_SUBSET -->
+      <value>"$5": element has${ 8} attribute(s) defined in the internal subset: "$6"</value>
+    </entry>
+
+    <entry key="libxml_ERR_515"> <!-- XML_DTD_INVALID_CHILD -->
+      <value>"$5": element not declared in list of possible children of "$6"</value>
+    </entry>
+
+    <entry key="libxml_ERR_516"> <!-- XML_DTD_INVALID_DEFAULT -->
+      <value>"xmlns$6?{:5}" invalid attribute of "$6?6:5"</value>
+    </entry>
+
+    <entry key="libxml_ERR_517"> <!-- XML_DTD_LOAD_ERROR -->
+      <value>"$5": could not load external subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_518"> <!-- XML_DTD_MISSING_ATTRIBUTE -->
+      <value>"$7?{6:}$7?7:6": attribute not carried by element "$5"</value>
+    </entry>
+
+    <entry key="libxml_ERR_519"> <!-- XML_DTD_MIXED_CORRUPT -->
+      <value>internal MIXED struct corrupted</value>
+    </entry>
+
+    <entry key="libxml_ERR_520"> <!-- XML_DTD_MULTIPLE_ID -->
+      <value>"$5": element has too many ID attributes defined: "$6"</value>
+    </entry>
+
+    <entry key="libxml_ERR_521"> <!-- XML_DTD_NO_DOC -->
+      <value>document is null</value>
+    </entry>
+
+    <entry key="libxml_ERR_522"> <!-- XML_DTD_NO_DTD -->
+      <value>document without internal/external subset or no DTD found</value>
+    </entry>
+
+    <!-- 523: XML_DTD_NO_ELEM_NAME not used -->
+
+    <entry key="libxml_ERR_524"> <!-- XML_DTD_NO_PREFIX -->
+      <value>"$6:$7": required attribute of element "$5" has no prefix</value>
+    </entry>
+
+    <entry key="libxml_ERR_525"> <!-- XML_DTD_NO_ROOT -->
+      <value>no root element</value>
+    </entry>
+
+    <entry key="libxml_ERR_526"> <!-- XML_DTD_NOTATION_REDEFINED -->
+      <value>"$5": notation already defined</value>
+    </entry>
+
+    <entry key="libxml_ERR_527"> <!-- XML_DTD_NOTATION_VALUE -->
+      <value>"$5": value for attribute "xmlns$7?{:6}" of element "$7?7:6" is not among the enumerated notations</value>
+    </entry>
+
+    <entry key="libxml_ERR_528"> <!-- XML_DTD_NOT_EMPTY -->
+      <value>"$5": element declared empty but has content</value>
+    </entry>
+
+    <entry key="libxml_ERR_529"> <!-- XML_DTD_NOT_PCDATA -->
+      <value>"$5": element declared "#PCDATA" but has non-text nodes</value>
+    </entry>
+
+    <entry key="libxml_ERR_530"> <!-- XML_DTD_NOT_STANDALONE -->
+      <value>"$5" on "$6" value has to be normalized based on external subset declaration</value>
+    </entry>
+
+    <entry key="libxml_ERR_531"> <!-- XML_DTD_ROOT_NAME -->
+      <value>"$5"/"$6": root/DTD name mismatch</value>
+    </entry>
+
+    <entry key="libxml_ERR_532"> <!-- XML_DTD_STANDALONE_WHITE_SPACE -->
+      <value>"$5": element declared in external subset contains whitespace nodes</value>
+    </entry>
+
+    <entry key="libxml_ERR_533"> <!-- XML_DTD_UNKNOWN_ATTRIBUTE -->
+      <value>"$6?6:{xmlns}": attribute not declated for element "$6?6:5"</value>
+    </entry>
+
+    <entry key="libxml_ERR_534"> <!-- XML_DTD_UNKNOWN_ELEM -->
+      <value>"$6?6:5": undeclared element$6?{ for attribute "5"}</value>
+    </entry>
+
+    <entry key="libxml_ERR_535"> <!-- XML_DTD_UNKNOWN_ENTITY -->
+      <value>$5?{"6": unknown entity referenced by attribute "5"}:{unknown entity type}</value>
+    </entry>
+
+    <entry key="libxml_ERR_536"> <!-- XML_DTD_UNKNOWN_ID -->
+      <value>"$5": attribute references an unknown ID "$6"${ on line 8}"</value>
+    </entry>
+
+    <entry key="libxml_ERR_537"> <!-- XML_DTD_UNKNOWN_NOTATION -->
+      <!--
+       ! We can't do better here since libxml uses puts different things in the
+       ! positional parameters.
+       !-->
+      <value>"$5": unknown notation</value>
+    </entry>
+
+    <entry key="libxml_ERR_538"> <!-- XML_DTD_STANDALONE_DEFAULTED -->
+      <value>"$5": attribute on "$7" defaulted from external subset</value>
+    </entry>
+
+    <entry key="libxml_ERR_539"> <!-- XML_DTD_XMLID_VALUE -->
+      <value>"$5": xml:id attribute value is not an NCName</value>
+    </entry>
+
+    <entry key="libxml_ERR_540"> <!-- XML_DTD_XMLID_TYPE -->
+      <value>"$5": xml:id attribute type must be ID</value>
+    </entry>
+
+    <entry key="libxml_ERR_541"> <!-- XML_DTD_DUP_TOKEN -->
+      <value>"$5": duplicate attribute enumeration value token</value>
+    </entry>
+
   </subvalues>
 
 </diagnostic-list>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2013-01-11 17:37:08 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2013-01-18 04:42:26 +0000
@@ -1341,6 +1341,9 @@
 ZorbaWarningCode ZWST0006_CACHING_MIGHT_NOT_BE_INTENDED( "ZWST0006" );
 
 
+ZorbaWarningCode ZWST0007_LOADER_PARSING_WARNING( "ZWST0007" );
+
+
 } // namespace zwarn
 
 } // namespace zorba

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-01-11 17:37:08 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-01-18 04:42:26 +0000
@@ -461,7 +461,7 @@
   { "ZSTR0015", "\"$1\": integrity constraint already exists" },
   { "ZSTR0016", "\"$1\": integrity constraint does not exist" },
   { "ZSTR0020", "loader I/O error${: 1}" },
-  { "ZSTR0021", "loader parsing error${: 1}" },
+  { "ZSTR0021", "\"$1\":$2,$3: loader parsing error${: 4}" },
   { "ZSTR0030", "NodeID error${: 1}" },
   { "ZSTR0040", "type error${: 1}" },
   { "ZSTR0041", "NaN comparison" },
@@ -476,6 +476,7 @@
   { "ZWST0004", "sequential FLWOR expr may not have the semantics you expect" },
   { "ZWST0005", "\"$1\": function caching not possible; $2" },
   { "ZWST0006", "\"$1\": function caching might not give the intended result because the function is declared as $2" },
+  { "ZWST0007", "\"$1\":$2,$3: loader parsing warning${: 4}" },
   { "ZXQD0001", "\"$1\": prefix not declared when calling function \"$2\" from $3" },
   { "ZXQD0002", "\"$1\": $2" },
   { "ZXQD0003", "inconsistent options to the parse-xml() function: $1" },
@@ -970,6 +971,150 @@
   { "~full-text static warning", "full-text static warning" },
   { "~full-text type error", "full-text type error" },
   { "~full-text type warning", "full-text type warning" },
+  { "~libxml_ERR_1", "libxml internal error${: 9}" },
+  { "~libxml_ERR_101", "encoding expected in text declaration" },
+  { "~libxml_ERR_103", "\"$5\": entity marked standalone but requires external subset" },
+  { "~libxml_ERR_104", "\"$5\": failed to process entity or called while not in subset" },
+  { "~libxml_ERR_105", "\"$5\": external or public ID missing or called while not in subset" },
+  { "~libxml_ERR_108", "\"$5\": unsupprted XML version" },
+  { "~libxml_ERR_109", "document/entity version mismatch" },
+  { "~libxml_ERR_110", "$5 too long (use XML_PARSE_HUGE option)" },
+  { "~libxml_ERR_18", "PE reference at end of XML document" },
+  { "~libxml_ERR_19", "PE reference in prolog" },
+  { "~libxml_ERR_2", "out of memory${: 9}" },
+  { "~libxml_ERR_20", "PE reference in epilog" },
+  { "~libxml_ERR_200", "${\"5\": }invalid namespace or prefix" },
+  { "~libxml_ERR_201", "${\"5\": }namespace prefix${ for \"7?6\"}${ on \"7?7:6\"} not defined" },
+  { "~libxml_ERR_202", "\"$5${:6}\": invalid XML QName" },
+  { "~libxml_ERR_203", "\"$5\": attribute in namespace \"$6\" redefined" },
+  { "~libxml_ERR_204", "empty namespace for prefix \"$5\"" },
+  { "~libxml_ERR_205", "\"$5\": colon is forbidden in entity, notation, and processing instruction names" },
+  { "~libxml_ERR_21", "PE reference forbidden within markup declaration in internal subset" },
+  { "~libxml_ERR_23", "';' expected at end of character entity reference" },
+  { "~libxml_ERR_24", "PE reference: no name" },
+  { "~libxml_ERR_25", "PE reference: ';' expected" },
+  { "~libxml_ERR_26", "${\"5\": }undeclared entity reference" },
+  { "~libxml_ERR_28", "${\"5\": }entity reference to unparsed entity" },
+  { "~libxml_ERR_29", "${\"5\": }external entity referenced by attribute" },
+  { "~libxml_ERR_30", "${\"5\": }parameter entity attempted reference" },
+  { "~libxml_ERR_31", "${\"5\": }unknown character encoding" },
+  { "~libxml_ERR_32", "${\"5\": }unsupported character encoding" },
+  { "~libxml_ERR_33", "string not started (' or \" expected)" },
+  { "~libxml_ERR_34", "string not ended (' or \" expected)" },
+  { "~libxml_ERR_35", "${\"5\": }invalid namespace declaration" },
+  { "~libxml_ERR_36", "entity value not started (' or \" expected)" },
+  { "~libxml_ERR_37", "${\"5\": }entity value not ended (' or \" expected)" },
+  { "~libxml_ERR_38", "unescaped '<' not allowed in attribute values" },
+  { "~libxml_ERR_39", "attribute value not started (' or \" expected)" },
+  { "~libxml_ERR_4", "empty XML document ('<' expected)" },
+  { "~libxml_ERR_40", "attribute value not ended (' or \" expected) or too big" },
+  { "~libxml_ERR_41", "${\"5\": }attribute must have a value" },
+  { "~libxml_ERR_42", "\"$6?{5:}$6?6:5\" attribute redefined" },
+  { "~libxml_ERR_43", "' or \" expected" },
+  { "~libxml_ERR_44", "' or \" expected to end System or Public ID literal" },
+  { "~libxml_ERR_45", "comment not ended (\"-->\" expected) or too big" },
+  { "~libxml_ERR_46", "processing instruction not started correctly (missing target name?)" },
+  { "~libxml_ERR_47", "processing instruction \"$5\" not ended (\"?>\" expected) or too big" },
+  { "~libxml_ERR_48", "notation name expected" },
+  { "~libxml_ERR_49", "'>' expected to end notation declaration" },
+  { "~libxml_ERR_5", "extra content at end of XML document" },
+  { "~libxml_ERR_50", "'(' expected to start ATTLIST enumeration" },
+  { "~libxml_ERR_500", "\"$5\": invalid attribute value" },
+  { "~libxml_ERR_501", "\"$5\": attribute of element \"$6\" already defined" },
+  { "~libxml_ERR_502", "\"$5\": invalid attribute value" },
+  { "~libxml_ERR_503", "\"$5\": defintion has duplicate references to \"$6\"" },
+  { "~libxml_ERR_504", "${\"5:\" }element content does not follow DTD" },
+  { "~libxml_ERR_505", "\"$5\": content model is not deteministic" },
+  { "~libxml_ERR_506", "element \"$5\" required attribute \"$6:$7\" has different prefix" },
+  { "~libxml_ERR_507", "\"$5\": element namespace name for default namespace does not match DTD" },
+  { "~libxml_ERR_508", "\"$7?6:5\": invalid attribute value or element namespace name does not match DTD" },
+  { "~libxml_ERR_509", "\"$5\": element redefined" },
+  { "~libxml_ERR_51", "')' expected to end ATTLIST enumeration" },
+  { "~libxml_ERR_510", "\"$5\": notation attribute declared \"EMPTY\" for element \"$6\"" },
+  { "~libxml_ERR_511", "\"$5\": ENTITY attribute references an entity \"$6\" of wrong type" },
+  { "~libxml_ERR_512", "\"$5\": invalid ID attribute of \"$6\" (\"#IMPLIED\" or \"#REQUIRED\" expected)" },
+  { "~libxml_ERR_513", "\"$5\": ID already defined" },
+  { "~libxml_ERR_514", "\"$5\": element has${ 8} attribute(s) defined in the internal subset: \"$6\"" },
+  { "~libxml_ERR_515", "\"$5\": element not declared in list of possible children of \"$6\"" },
+  { "~libxml_ERR_516", "\"xmlns$6?{:5}\" invalid attribute of \"$6?6:5\"" },
+  { "~libxml_ERR_517", "\"$5\": could not load external subset" },
+  { "~libxml_ERR_518", "\"$7?{6:}$7?7:6\": attribute not carried by element \"$5\"" },
+  { "~libxml_ERR_519", "internal MIXED struct corrupted" },
+  { "~libxml_ERR_52", "'|' or \")*\" expected for mixed content declaration" },
+  { "~libxml_ERR_520", "\"$5\": element has too many ID attributes defined: \"$6\"" },
+  { "~libxml_ERR_521", "document is null" },
+  { "~libxml_ERR_522", "document without internal/external subset or no DTD found" },
+  { "~libxml_ERR_524", "\"$6:$7\": required attribute of element \"$5\" has no prefix" },
+  { "~libxml_ERR_525", "no root element" },
+  { "~libxml_ERR_526", "\"$5\": notation already defined" },
+  { "~libxml_ERR_527", "\"$5\": value for attribute \"xmlns$7?{:6}\" of element \"$7?7:6\" is not among the enumerated notations" },
+  { "~libxml_ERR_528", "\"$5\": element declared empty but has content" },
+  { "~libxml_ERR_529", "\"$5\": element declared \"#PCDATA\" but has non-text nodes" },
+  { "~libxml_ERR_530", "\"$5\" on \"$6\" value has to be normalized based on external subset declaration" },
+  { "~libxml_ERR_531", "\"$5\"/\"$6\": root/DTD name mismatch" },
+  { "~libxml_ERR_532", "\"$5\": element declared in external subset contains whitespace nodes" },
+  { "~libxml_ERR_533", "\"$6?6:{xmlns}\": attribute not declated for element \"$6?6:5\"" },
+  { "~libxml_ERR_534", "\"$6?6:5\": undeclared element$6?{ for attribute \"5\"}" },
+  { "~libxml_ERR_535", "$5?{\"6\": unknown entity referenced by attribute \"5\"}:{unknown entity type}" },
+  { "~libxml_ERR_536", "\"$5\": attribute references an unknown ID \"$6\"${ on line 8}\"" },
+  { "~libxml_ERR_537", "\"$5\": unknown notation" },
+  { "~libxml_ERR_538", "\"$5\": attribute on \"$7\" defaulted from external subset" },
+  { "~libxml_ERR_539", "\"$5\": xml:id attribute value is not an NCName" },
+  { "~libxml_ERR_54", "$5?5:{name or} '(' expected for content declaration" },
+  { "~libxml_ERR_540", "\"$5\": xml:id attribute type must be ID" },
+  { "~libxml_ERR_541", "\"$5\": duplicate attribute enumeration value token" },
+  { "~libxml_ERR_55", "',', '|', or ')' expected in content declaration${ or depth 8 too deep}" },
+  { "~libxml_ERR_56", "\"<?xml\" required to start XML declaration" },
+  { "~libxml_ERR_57", "\"?>\" expected to end XML declaration" },
+  { "~libxml_ERR_59", "XML conditional section not ended" },
+  { "~libxml_ERR_6", "${\"5\": }invalid hexedecimal value for character reference" },
+  { "~libxml_ERR_60", "content error in external subset" },
+  { "~libxml_ERR_61", "DOCTYPE improperly ended" },
+  { "~libxml_ERR_62", "\"]]>\" not allowed in content" },
+  { "~libxml_ERR_63", "CDATA not ended (\"]]>\" expected) or too big" },
+  { "~libxml_ERR_64", "\"xml\": reserved XML prefix" },
+  { "~libxml_ERR_65", "space required here" },
+  { "~libxml_ERR_66", "'$8' expected" },
+  { "~libxml_ERR_67", "NMTOKEN expected in ATTLIST enumeration" },
+  { "~libxml_ERR_68", "name expected" },
+  { "~libxml_ERR_69", "\"#PCDATA\" expected" },
+  { "~libxml_ERR_7", "${\"5\": }invalid decimal value for character reference" },
+  { "~libxml_ERR_70", "URI expected for SYSTEM or PUBLIC" },
+  { "~libxml_ERR_71", "PUBLIC identifier expected" },
+  { "~libxml_ERR_72", "'<' expected" },
+  { "~libxml_ERR_73", "'>' expected" },
+  { "~libxml_ERR_74", "\"</\" expected" },
+  { "~libxml_ERR_75", "'=' expected" },
+  { "~libxml_ERR_76", "\"</$6>\": closing tag mismatch for \"<$5>\"" },
+  { "~libxml_ERR_77", "\"$5\": premature end of content for tag starting on line $8" },
+  { "~libxml_ERR_78", "\"yes\" or \"no\" expected for \"standalone\"" },
+  { "~libxml_ERR_79", "invalid XML encoding name" },
+  { "~libxml_ERR_8", "${\"5\": }invalid value for character reference" },
+  { "~libxml_ERR_80", "\"--\" forbidden within XML comment" },
+  { "~libxml_ERR_81", "document labelled UTF-16 but has UTF-8 content" },
+  { "~libxml_ERR_83", "'[' expected in XML condition section" },
+  { "~libxml_ERR_84", "entity value expected" },
+  { "~libxml_ERR_85", "XML chunk is not well-balanced" },
+  { "~libxml_ERR_86", "extra content at end of well-balanced chunk" },
+  { "~libxml_ERR_87", "'$8' forbidden except for entity references" },
+  { "~libxml_ERR_88", "invalid entity type" },
+  { "~libxml_ERR_89", "entity reference loop" },
+  { "~libxml_ERR_9", "${\"&#8;\": }invalid XML character value" },
+  { "~libxml_ERR_90", "declaration must start and end in the same entity" },
+  { "~libxml_ERR_91", "\"$5\": invalid URI" },
+  { "~libxml_ERR_92", "URI fragment not allowed" },
+  { "~libxml_ERR_94", "validation failed: no DTD found" },
+  { "~libxml_ERR_95", "\"IGNORE\" or \"INCLUDE\" expected" },
+  { "~libxml_ERR_96", "XML version expected" },
+  { "~libxml_WAR_100", "xmlns$6?{:5}: URI \"$6?6:5\": invalid URI" },
+  { "~libxml_WAR_102", "\"$5\": invalid value for \"xml:space\"; either \"default\" or \"preserve\" expected" },
+  { "~libxml_WAR_106", "\"$5\": avoid attribute ending with ':'" },
+  { "~libxml_WAR_107", "\"$5\": entity already defined in the internal subset" },
+  { "~libxml_WAR_27", "${\"5\": }undeclared entity reference" },
+  { "~libxml_WAR_93", "\"$5\": catalog processing instruction syntax error" },
+  { "~libxml_WAR_97", "\"$5\": unsupported XML version" },
+  { "~libxml_WAR_98", "\"$5\": malformed xml:lang value" },
+  { "~libxml_WAR_99", "xmlns$6?{:5}: URI \"$6?6:5\": invalid URI" },
   { "~operating system error", "operating system error" },
   { "~scripting static error", "scripting static error" },
   { "~scripting static warning", "scripting static warning" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2013-01-10 19:24:23 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2013-01-18 04:42:26 +0000
@@ -339,6 +339,150 @@
 #define ZED_FormatNumberAtLeastOneOptionalOrDecimal "~FormatNumberAtLeastOneOptionalOrDecimal"
 #define ZED_FUNCTION "~FUNCTION"
 #define ZED_ANNOTATION "~ANNOTATION"
+#define ZED_libxml_ERR_1 "~libxml_ERR_1"
+#define ZED_libxml_ERR_2 "~libxml_ERR_2"
+#define ZED_libxml_ERR_4 "~libxml_ERR_4"
+#define ZED_libxml_ERR_5 "~libxml_ERR_5"
+#define ZED_libxml_ERR_6 "~libxml_ERR_6"
+#define ZED_libxml_ERR_7 "~libxml_ERR_7"
+#define ZED_libxml_ERR_8 "~libxml_ERR_8"
+#define ZED_libxml_ERR_9 "~libxml_ERR_9"
+#define ZED_libxml_ERR_18 "~libxml_ERR_18"
+#define ZED_libxml_ERR_19 "~libxml_ERR_19"
+#define ZED_libxml_ERR_20 "~libxml_ERR_20"
+#define ZED_libxml_ERR_21 "~libxml_ERR_21"
+#define ZED_libxml_ERR_23 "~libxml_ERR_23"
+#define ZED_libxml_ERR_24 "~libxml_ERR_24"
+#define ZED_libxml_ERR_25 "~libxml_ERR_25"
+#define ZED_libxml_ERR_26 "~libxml_ERR_26"
+#define ZED_libxml_WAR_27 "~libxml_WAR_27"
+#define ZED_libxml_ERR_28 "~libxml_ERR_28"
+#define ZED_libxml_ERR_29 "~libxml_ERR_29"
+#define ZED_libxml_ERR_30 "~libxml_ERR_30"
+#define ZED_libxml_ERR_31 "~libxml_ERR_31"
+#define ZED_libxml_ERR_32 "~libxml_ERR_32"
+#define ZED_libxml_ERR_33 "~libxml_ERR_33"
+#define ZED_libxml_ERR_34 "~libxml_ERR_34"
+#define ZED_libxml_ERR_35 "~libxml_ERR_35"
+#define ZED_libxml_ERR_36 "~libxml_ERR_36"
+#define ZED_libxml_ERR_37 "~libxml_ERR_37"
+#define ZED_libxml_ERR_38 "~libxml_ERR_38"
+#define ZED_libxml_ERR_39 "~libxml_ERR_39"
+#define ZED_libxml_ERR_40 "~libxml_ERR_40"
+#define ZED_libxml_ERR_41 "~libxml_ERR_41"
+#define ZED_libxml_ERR_42 "~libxml_ERR_42"
+#define ZED_libxml_ERR_43 "~libxml_ERR_43"
+#define ZED_libxml_ERR_44 "~libxml_ERR_44"
+#define ZED_libxml_ERR_45 "~libxml_ERR_45"
+#define ZED_libxml_ERR_46 "~libxml_ERR_46"
+#define ZED_libxml_ERR_47 "~libxml_ERR_47"
+#define ZED_libxml_ERR_48 "~libxml_ERR_48"
+#define ZED_libxml_ERR_49 "~libxml_ERR_49"
+#define ZED_libxml_ERR_50 "~libxml_ERR_50"
+#define ZED_libxml_ERR_51 "~libxml_ERR_51"
+#define ZED_libxml_ERR_52 "~libxml_ERR_52"
+#define ZED_libxml_ERR_54 "~libxml_ERR_54"
+#define ZED_libxml_ERR_55 "~libxml_ERR_55"
+#define ZED_libxml_ERR_56 "~libxml_ERR_56"
+#define ZED_libxml_ERR_57 "~libxml_ERR_57"
+#define ZED_libxml_ERR_59 "~libxml_ERR_59"
+#define ZED_libxml_ERR_60 "~libxml_ERR_60"
+#define ZED_libxml_ERR_61 "~libxml_ERR_61"
+#define ZED_libxml_ERR_62 "~libxml_ERR_62"
+#define ZED_libxml_ERR_63 "~libxml_ERR_63"
+#define ZED_libxml_ERR_64 "~libxml_ERR_64"
+#define ZED_libxml_ERR_65 "~libxml_ERR_65"
+#define ZED_libxml_ERR_66 "~libxml_ERR_66"
+#define ZED_libxml_ERR_67 "~libxml_ERR_67"
+#define ZED_libxml_ERR_68 "~libxml_ERR_68"
+#define ZED_libxml_ERR_69 "~libxml_ERR_69"
+#define ZED_libxml_ERR_70 "~libxml_ERR_70"
+#define ZED_libxml_ERR_71 "~libxml_ERR_71"
+#define ZED_libxml_ERR_72 "~libxml_ERR_72"
+#define ZED_libxml_ERR_73 "~libxml_ERR_73"
+#define ZED_libxml_ERR_74 "~libxml_ERR_74"
+#define ZED_libxml_ERR_75 "~libxml_ERR_75"
+#define ZED_libxml_ERR_76 "~libxml_ERR_76"
+#define ZED_libxml_ERR_77 "~libxml_ERR_77"
+#define ZED_libxml_ERR_78 "~libxml_ERR_78"
+#define ZED_libxml_ERR_79 "~libxml_ERR_79"
+#define ZED_libxml_ERR_80 "~libxml_ERR_80"
+#define ZED_libxml_ERR_81 "~libxml_ERR_81"
+#define ZED_libxml_ERR_83 "~libxml_ERR_83"
+#define ZED_libxml_ERR_84 "~libxml_ERR_84"
+#define ZED_libxml_ERR_85 "~libxml_ERR_85"
+#define ZED_libxml_ERR_86 "~libxml_ERR_86"
+#define ZED_libxml_ERR_87 "~libxml_ERR_87"
+#define ZED_libxml_ERR_88 "~libxml_ERR_88"
+#define ZED_libxml_ERR_89 "~libxml_ERR_89"
+#define ZED_libxml_ERR_90 "~libxml_ERR_90"
+#define ZED_libxml_ERR_91 "~libxml_ERR_91"
+#define ZED_libxml_ERR_92 "~libxml_ERR_92"
+#define ZED_libxml_WAR_93 "~libxml_WAR_93"
+#define ZED_libxml_ERR_94 "~libxml_ERR_94"
+#define ZED_libxml_ERR_95 "~libxml_ERR_95"
+#define ZED_libxml_ERR_96 "~libxml_ERR_96"
+#define ZED_libxml_WAR_97 "~libxml_WAR_97"
+#define ZED_libxml_WAR_98 "~libxml_WAR_98"
+#define ZED_libxml_WAR_99 "~libxml_WAR_99"
+#define ZED_libxml_WAR_100 "~libxml_WAR_100"
+#define ZED_libxml_ERR_101 "~libxml_ERR_101"
+#define ZED_libxml_WAR_102 "~libxml_WAR_102"
+#define ZED_libxml_ERR_103 "~libxml_ERR_103"
+#define ZED_libxml_ERR_104 "~libxml_ERR_104"
+#define ZED_libxml_ERR_105 "~libxml_ERR_105"
+#define ZED_libxml_WAR_106 "~libxml_WAR_106"
+#define ZED_libxml_WAR_107 "~libxml_WAR_107"
+#define ZED_libxml_ERR_108 "~libxml_ERR_108"
+#define ZED_libxml_ERR_109 "~libxml_ERR_109"
+#define ZED_libxml_ERR_110 "~libxml_ERR_110"
+#define ZED_libxml_ERR_200 "~libxml_ERR_200"
+#define ZED_libxml_ERR_201 "~libxml_ERR_201"
+#define ZED_libxml_ERR_202 "~libxml_ERR_202"
+#define ZED_libxml_ERR_203 "~libxml_ERR_203"
+#define ZED_libxml_ERR_204 "~libxml_ERR_204"
+#define ZED_libxml_ERR_205 "~libxml_ERR_205"
+#define ZED_libxml_ERR_500 "~libxml_ERR_500"
+#define ZED_libxml_ERR_501 "~libxml_ERR_501"
+#define ZED_libxml_ERR_502 "~libxml_ERR_502"
+#define ZED_libxml_ERR_503 "~libxml_ERR_503"
+#define ZED_libxml_ERR_504 "~libxml_ERR_504"
+#define ZED_libxml_ERR_505 "~libxml_ERR_505"
+#define ZED_libxml_ERR_506 "~libxml_ERR_506"
+#define ZED_libxml_ERR_507 "~libxml_ERR_507"
+#define ZED_libxml_ERR_508 "~libxml_ERR_508"
+#define ZED_libxml_ERR_509 "~libxml_ERR_509"
+#define ZED_libxml_ERR_510 "~libxml_ERR_510"
+#define ZED_libxml_ERR_511 "~libxml_ERR_511"
+#define ZED_libxml_ERR_512 "~libxml_ERR_512"
+#define ZED_libxml_ERR_513 "~libxml_ERR_513"
+#define ZED_libxml_ERR_514 "~libxml_ERR_514"
+#define ZED_libxml_ERR_515 "~libxml_ERR_515"
+#define ZED_libxml_ERR_516 "~libxml_ERR_516"
+#define ZED_libxml_ERR_517 "~libxml_ERR_517"
+#define ZED_libxml_ERR_518 "~libxml_ERR_518"
+#define ZED_libxml_ERR_519 "~libxml_ERR_519"
+#define ZED_libxml_ERR_520 "~libxml_ERR_520"
+#define ZED_libxml_ERR_521 "~libxml_ERR_521"
+#define ZED_libxml_ERR_522 "~libxml_ERR_522"
+#define ZED_libxml_ERR_524 "~libxml_ERR_524"
+#define ZED_libxml_ERR_525 "~libxml_ERR_525"
+#define ZED_libxml_ERR_526 "~libxml_ERR_526"
+#define ZED_libxml_ERR_527 "~libxml_ERR_527"
+#define ZED_libxml_ERR_528 "~libxml_ERR_528"
+#define ZED_libxml_ERR_529 "~libxml_ERR_529"
+#define ZED_libxml_ERR_530 "~libxml_ERR_530"
+#define ZED_libxml_ERR_531 "~libxml_ERR_531"
+#define ZED_libxml_ERR_532 "~libxml_ERR_532"
+#define ZED_libxml_ERR_533 "~libxml_ERR_533"
+#define ZED_libxml_ERR_534 "~libxml_ERR_534"
+#define ZED_libxml_ERR_535 "~libxml_ERR_535"
+#define ZED_libxml_ERR_536 "~libxml_ERR_536"
+#define ZED_libxml_ERR_537 "~libxml_ERR_537"
+#define ZED_libxml_ERR_538 "~libxml_ERR_538"
+#define ZED_libxml_ERR_539 "~libxml_ERR_539"
+#define ZED_libxml_ERR_540 "~libxml_ERR_540"
+#define ZED_libxml_ERR_541 "~libxml_ERR_541"
 
 #endif /* ZORBA_DIAGNOSTICS_ZED_KEYS */
 /*

=== modified file 'src/store/naive/loader.h'
--- src/store/naive/loader.h	2012-09-19 21:16:15 +0000
+++ src/store/naive/loader.h	2013-01-18 04:42:26 +0000
@@ -110,6 +110,8 @@
       const zstring& baseUri,
       const zstring& docUri,
       std::istream& xmlStream) = 0;
+
+  static void error( void *ctx, xmlErrorPtr );
 };
 
 
@@ -217,10 +219,6 @@
         const xmlChar * target,
         const xmlChar * data);
 
-  static void error(void * ctx, const char * msg, ... );
-
-  static void warning(void * ctx, const char * msg, ... );
-
   static xmlEntityPtr	getEntity(
         void * ctx,
         const xmlChar * name);
@@ -412,10 +410,6 @@
         const xmlChar * target,
         const xmlChar * data);
 
-  static void error(void * ctx, const char * msg, ... );
-
-  static void warning(void * ctx, const char * msg, ... );
-
   static xmlEntityPtr	getEntity(
         void * ctx,
         const xmlChar * name);
@@ -438,8 +432,6 @@
 } // namespace zorba
 
 #endif /* ZORBA_SIMPLE_STORE_LOADER */
-
-
 /*
  * Local variables:
  * mode: c++

=== modified file 'src/store/naive/loader_dtd.cpp'
--- src/store/naive/loader_dtd.cpp	2012-09-19 21:16:15 +0000
+++ src/store/naive/loader_dtd.cpp	2013-01-18 04:42:26 +0000
@@ -136,8 +136,7 @@
   theSaxHandler.cdataBlock = &FragmentXmlLoader::cdataBlock;
   theSaxHandler.comment = &FragmentXmlLoader::comment;
   theSaxHandler.processingInstruction = &FragmentXmlLoader::processingInstruction;
-  theSaxHandler.warning = &FragmentXmlLoader::warning;
-  theSaxHandler.error = &FragmentXmlLoader::error;
+  theSaxHandler.serror = &XmlLoader::error;
   theSaxHandler.getEntity = &FragmentXmlLoader::getEntity;
   theSaxHandler.getParameterEntity = &FragmentXmlLoader::getParameterEntity;
   theSaxHandler.entityDecl = &FragmentXmlLoader::entityDecl;
@@ -611,9 +610,7 @@
   //theSaxHandler.cdataBlock = &DtdXmlLoader::cdataBlock;
   //theSaxHandler.comment = &DtdXmlLoader::comment;
   //theSaxHandler.processingInstruction = &DtdXmlLoader::processingInstruction;
-  theSaxHandler.warning = &DtdXmlLoader::warning;
-  theSaxHandler.error = &DtdXmlLoader::error;
-
+  theSaxHandler.serror = &XmlLoader::error;
   theSaxHandler.getEntity = &DtdXmlLoader::getEntity;
   theSaxHandler.getParameterEntity = &DtdXmlLoader::getParameterEntity;
   theSaxHandler.entityDecl = &DtdXmlLoader::entityDecl;
@@ -1793,48 +1790,6 @@
 
 
 /*******************************************************************************
-  Display and format an error messages, callback.
-
-   ctx:  an XML parser context
-   msg:  the message to display/transmit
-   ...:  extra parameters for the message display
-********************************************************************************/
-void DtdXmlLoader::error(void * ctx, const char * msg, ... )
-{
-  DtdXmlLoader* loader = (static_cast<DtdXmlLoader *>(ctx));
-  char buf[1024];
-  va_list args;
-  va_start(args, msg);
-  vsprintf(buf, msg, args);
-  va_end(args);
-  loader->theXQueryDiagnostics->add_error(
-    NEW_ZORBA_EXCEPTION(
-      zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( buf )
-    )
-  );
-}
-
-
-/*******************************************************************************
-   Display and format a warning messages, callback.
-
-   ctx:  an XML parser context
-   msg:  the message to display/transmit
-   ...:  extra parameters for the message display
-********************************************************************************/
-void DtdXmlLoader::warning(void * ctx, const char * msg, ... )
-{
-  char buf[1024];
-  va_list args;
-  va_start(args, msg);
-  vsprintf(buf, msg, args);
-  va_end(args);
-
-  std::cerr << buf << std::endl;
-}
-
-
-/*******************************************************************************
 
 ********************************************************************************/
 xmlEntityPtr  DtdXmlLoader::getEntity(

=== modified file 'src/store/naive/loader_fast.cpp'
--- src/store/naive/loader_fast.cpp	2012-09-19 21:16:15 +0000
+++ src/store/naive/loader_fast.cpp	2013-01-18 04:42:26 +0000
@@ -96,6 +96,89 @@
 
 
 /*******************************************************************************
+  Display and format an error messages, callback.
+
+   ctx:  an XML parser context
+   msg:  the message to display/transmit
+   ...:  extra parameters for the message display
+********************************************************************************/
+void XmlLoader::error(void *ctx, xmlErrorPtr error)
+{
+  if ( error->level == XML_ERR_NONE )
+    return;
+
+  ztd::itoa_buf_type itoa_buf;
+
+  zstring libxml_dict_key_4( ZED_PREFIX "libxml_" );
+  libxml_dict_key_4 += error->level == XML_ERR_WARNING ? "WAR_" : "ERR_";
+  libxml_dict_key_4 += ztd::itoa( error->code, itoa_buf );
+
+  zstring str1_5, str2_6, str3_7, int1_8, message_9( error->message );
+  if ( error->str1 )
+    str1_5 = error->str1;
+  if ( error->str2 )
+    str2_6 = error->str2;
+  if ( error->str3 )
+    str3_7 = error->str3;
+
+  if ( error->int1 ) {                  // assume valid only if > 0
+    switch ( error->code ) {
+      case XML_ERR_ENTITY_CHAR_ERROR:
+      case XML_ERR_INVALID_CHAR:
+      case XML_ERR_SEPARATOR_REQUIRED:
+        // For these error codes, int1 is a char.
+        int1_8 = static_cast<char>( error->int1 );
+        break;
+      case XML_DTD_ID_SUBSET:
+      case XML_DTD_UNKNOWN_ID:
+      case XML_ERR_ELEMCONTENT_NOT_FINISHED:
+      case XML_ERR_INTERNAL_ERROR:
+      case XML_ERR_TAG_NOT_FINISHED:
+        // For these error codes, int1 is an int.
+        int1_8 = ztd::itoa( error->int1, itoa_buf );
+        break;
+      default:
+        // For an unaccounted-for error code, use a heuristic to guess whether
+        // int1 is a char or an int.
+        if ( ascii::is_print( error->int1 ) )
+          int1_8 = static_cast<char>( error->int1 );
+        else
+          int1_8 = ztd::itoa( error->int1, itoa_buf );
+    } // switch
+  } // if
+
+  XmlLoader *const loader = static_cast<FastXmlLoader*>(ctx);
+  switch ( error->level ) {
+    case XML_ERR_ERROR:
+    case XML_ERR_FATAL:
+      loader->theXQueryDiagnostics->add_error(
+        NEW_XQUERY_EXCEPTION(
+          zerr::ZSTR0021_LOADER_PARSING_ERROR,
+          ERROR_PARAMS(
+            error->file, error->line, error->int2 /* column */,
+            libxml_dict_key_4, str1_5, str2_6, str3_7, int1_8, message_9
+          )
+        )
+      );
+      break;
+    case XML_ERR_WARNING:
+      loader->theXQueryDiagnostics->add_warning(
+        NEW_XQUERY_WARNING(
+          zwarn::ZWST0007_LOADER_PARSING_WARNING,
+          WARN_PARAMS(
+            error->file, error->line, error->int2 /* column */,
+            libxml_dict_key_4, str1_5, str2_6, str3_7, int1_8, message_9
+          )
+        )
+      );
+      break;
+    default:
+      ZORBA_ASSERT( false );
+  } // switch
+}
+
+
+/*******************************************************************************
 
 ********************************************************************************/
 FastXmlLoader::FastXmlLoader(
@@ -124,9 +207,7 @@
   theSaxHandler.cdataBlock = &FastXmlLoader::cdataBlock;
   theSaxHandler.comment = &FastXmlLoader::comment;
   theSaxHandler.processingInstruction = &FastXmlLoader::processingInstruction;
-  theSaxHandler.warning = &FastXmlLoader::warning;
-  theSaxHandler.error = &FastXmlLoader::error;
-
+  theSaxHandler.serror = &XmlLoader::error;
   theSaxHandler.getEntity = &FastXmlLoader::getEntity;
   theSaxHandler.getParameterEntity = &FastXmlLoader::getParameterEntity;
   theSaxHandler.entityDecl = &FastXmlLoader::entityDecl;
@@ -1113,48 +1194,6 @@
 
 
 /*******************************************************************************
-  Display and format an error messages, callback.
-
-   ctx:  an XML parser context
-   msg:  the message to display/transmit
-   ...:  extra parameters for the message display
-********************************************************************************/
-void FastXmlLoader::error(void * ctx, const char * msg, ... )
-{
-  FastXmlLoader* loader = (static_cast<FastXmlLoader *>(ctx));
-  char buf[1024];
-  va_list args;
-  va_start(args, msg);
-  vsprintf(buf, msg, args);
-  va_end(args);
-  loader->theXQueryDiagnostics->add_error(
-    NEW_ZORBA_EXCEPTION(
-      zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( buf )
-    )
-  );
-}
-
-
-/*******************************************************************************
-   Display and format a warning messages, callback.
-
-   ctx:  an XML parser context
-   msg:  the message to display/transmit
-   ...:  extra parameters for the message display
-********************************************************************************/
-void FastXmlLoader::warning(void * ctx, const char * msg, ... )
-{
-  char buf[1024];
-  va_list args;
-  va_start(args, msg);
-  vsprintf(buf, msg, args);
-  va_end(args);
-
-  std::cerr << buf << std::endl;
-}
-
-
-/*******************************************************************************
 
 ********************************************************************************/
 xmlEntityPtr	FastXmlLoader::getEntity(


Follow ups