* xmlTextReaderSetErrorHandler: * @reader: the xmlTextReaderPtr used * @f: the callback function to call on error and warnings * @arg: a user argument to pass to the callback function * * DEPRECATED: Use xmlTextReaderSetStructuredErrorHandler. * * Register a callback function that will be called on error and warnings. * * If @f is NULL, the default error and warning handlers are resto
| 4704 | * If @f is NULL, the default error and warning handlers are restored. |
| 4705 | */ |
| 4706 | void |
| 4707 | xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, |
| 4708 | xmlTextReaderErrorFunc f, void *arg) |
| 4709 | { |
| 4710 | if (f != NULL) { |
| 4711 | reader->errorFunc = f; |
| 4712 | reader->sErrorFunc = NULL; |
| 4713 | reader->errorFuncArg = arg; |
| 4714 | xmlCtxtSetErrorHandler(reader->ctxt, |
| 4715 | xmlTextReaderStructuredRelay, reader); |
| 4716 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 4717 | if (reader->rngValidCtxt) { |
| 4718 | xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, |
| 4719 | xmlTextReaderStructuredRelay, reader); |
| 4720 | } |
| 4721 | if (reader->xsdValidCtxt) { |
| 4722 | xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, |
| 4723 | xmlTextReaderStructuredRelay, reader); |
| 4724 | } |
| 4725 | #endif |
| 4726 | } else { |
| 4727 | /* restore defaults */ |
| 4728 | reader->errorFunc = NULL; |
| 4729 | reader->sErrorFunc = NULL; |
| 4730 | reader->errorFuncArg = NULL; |
| 4731 | xmlCtxtSetErrorHandler(reader->ctxt, NULL, NULL); |
| 4732 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 4733 | if (reader->rngValidCtxt) { |
| 4734 | xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, |
| 4735 | NULL); |
| 4736 | } |
| 4737 | if (reader->xsdValidCtxt) { |
| 4738 | xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, |
| 4739 | NULL); |
| 4740 | } |
| 4741 | #endif |
| 4742 | } |
| 4743 | } |
| 4744 | |
| 4745 | /** |
| 4746 | * xmlTextReaderSetStructuredErrorHandler: |
nothing calls this directly
no test coverage detected