void reportError(void *ptr, xmlErrorPtr error) { ErrorInfo *errorInfo = (ErrorInfo*) ptr; assert(errorInfo); if (errorInfo->verbose) { int msglen; int domain = error->domain; const char *filename = error->file? error->file : errorInfo? errorInfo->filename : NULL; xmlTextReaderPtr reader = errorInfo->xmlReader; int line = (!filename)? 0 : (reader)? xmlTextReaderGetParserLineNumber(reader) : error->line; int column = (!filename)? 0 : (reader)? xmlTextReaderGetParserColumnNumber(reader) : error->int2; if (line) { fprintf(stderr, "%s:%d.%d: ", filename, line, column); } msglen = strlen(error->message); if (error->message[msglen-1] == '\n') error->message[msglen-1] = '\0'; fprintf(stderr, "%s", error->message); /* only print extra info if it's not in message */ if (error->str1 && strstr(error->message, error->str1) == NULL) { fprintf(stderr, ": %s", error->str1); if (error->str2 && strstr(error->message, error->str2) == NULL) { fprintf(stderr, ", %s", error->str2); } if (error->str3 && strstr(error->message, error->str3) == NULL) { fprintf(stderr, ", %s", error->str3); } } fprintf(stderr, "\n"); if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { xmlParserCtxtPtr ctxt = error->ctxt; if (ctxt) xmlParserPrintFileContext(ctxt->input); } } if (errorInfo->stop == STOP) { exit(EXIT_FAILURE); } }
/* reader:column_number() */ static int xmlreader_column_number(lua_State *L) { xmlreader xr = check_xmlreader(L, 1); int ret = xmlTextReaderGetParserColumnNumber(xr); if (ret != 0) lua_pushinteger(L, ret); else lua_pushnil(L); /* Should we just return 0? */ return 1; }
/* * call-seq: * reader.column_number -> number * * Provide the column number of the current parsing point. */ static VALUE rxml_reader_column_number(VALUE self) { return INT2NUM(xmlTextReaderGetParserColumnNumber(rxml_text_reader_get(self))); }
/* * call-seq: * reader.column_number -> number * * Provide the column number of the current parsing point. */ static VALUE rxml_reader_column_number(VALUE self) { xmlTextReaderPtr xreader = rxml_text_reader_get(self); return INT2NUM(xmlTextReaderGetParserColumnNumber(xreader)); }
int XmlTextReader::LinePosition() const { return xmlTextReaderGetParserColumnNumber(ToReader(m_p)); }