| 131 | } |
| 132 | |
| 133 | static int |
| 134 | xmlVUpdateError(xmlError *err, |
| 135 | void *ctxt, xmlNodePtr node, |
| 136 | int domain, int code, xmlErrorLevel level, |
| 137 | const char *file, int line, |
| 138 | const char *str1, const char *str2, const char *str3, |
| 139 | int int1, int col, |
| 140 | const char *fmt, va_list ap) |
| 141 | { |
| 142 | int res; |
| 143 | |
| 144 | /* |
| 145 | * Find first element parent. |
| 146 | */ |
| 147 | if (node != NULL) { |
| 148 | int i; |
| 149 | |
| 150 | for (i = 0; i < 10; i++) { |
| 151 | if ((node->type == XML_ELEMENT_NODE) || |
| 152 | (node->parent == NULL)) |
| 153 | break; |
| 154 | node = node->parent; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /* |
| 159 | * Get file and line from node. |
| 160 | */ |
| 161 | if (node != NULL) { |
| 162 | if ((file == NULL) && (node->doc != NULL)) |
| 163 | file = (const char *) node->doc->URL; |
| 164 | |
| 165 | if (line == 0) { |
| 166 | if (node->type == XML_ELEMENT_NODE) |
| 167 | line = node->line; |
| 168 | if ((line == 0) || (line == 65535)) |
| 169 | line = xmlGetLineNo(node); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | res = xmlVSetError(err, ctxt, node, domain, code, level, file, line, |
| 174 | str1, str2, str3, int1, col, fmt, ap); |
| 175 | |
| 176 | return(res); |
| 177 | } |
| 178 | |
| 179 | /************************************************************************ |
| 180 | * * |
no test coverage detected