MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlTextReaderLocator

Function xmlTextReaderLocator

ThirdParty/libxml2/vtklibxml2/xmlreader.c:4135–4176  ·  view source on GitHub ↗

* xmlTextReaderLocator: * @ctx: the xmlTextReaderPtr used * @file: returned file information * @line: returned line information * * Internal locator function for the readers * * Returns 0 in case the Schema validation could be (de)activated and * -1 in case of error. */

Source from the content-addressed store, hash-verified

4133 * -1 in case of error.
4134 */
4135static int
4136xmlTextReaderLocator(void *ctx, const char **file, unsigned long *line) {
4137 xmlTextReaderPtr reader;
4138
4139 if ((ctx == NULL) || ((file == NULL) && (line == NULL)))
4140 return(-1);
4141
4142 if (file != NULL)
4143 *file = NULL;
4144 if (line != NULL)
4145 *line = 0;
4146
4147 reader = (xmlTextReaderPtr) ctx;
4148 if ((reader->ctxt != NULL) && (reader->ctxt->input != NULL)) {
4149 if (file != NULL)
4150 *file = reader->ctxt->input->filename;
4151 if (line != NULL)
4152 *line = reader->ctxt->input->line;
4153 return(0);
4154 }
4155 if (reader->node != NULL) {
4156 long res;
4157 int ret = 0;
4158
4159 if (line != NULL) {
4160 res = xmlGetLineNo(reader->node);
4161 if (res > 0)
4162 *line = (unsigned long) res;
4163 else
4164 ret = -1;
4165 }
4166 if (file != NULL) {
4167 xmlDocPtr doc = reader->node->doc;
4168 if ((doc != NULL) && (doc->URL != NULL))
4169 *file = (const char *) doc->URL;
4170 else
4171 ret = -1;
4172 }
4173 return(ret);
4174 }
4175 return(-1);
4176}
4177
4178/**
4179 * xmlTextReaderSetSchema:

Callers

nothing calls this directly

Calls 1

xmlGetLineNoFunction · 0.85

Tested by

no test coverage detected