MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / startElement

Function startElement

samples/geotag.cpp:268–289  ·  view source on GitHub ↗

XML Parser Callbacks

Source from the content-addressed store, hash-verified

266
267// XML Parser Callbacks
268static void startElement(void* userData, const char* name, const char** atts) {
269 auto me = static_cast<UserData*>(userData);
270 // for ( int i = 0 ; i < me->indent ; i++ ) printf(" ");
271 // printf("begin %s\n",name);
272 me->bTime = strcmp(name, "time") == 0;
273 me->bEle = strcmp(name, "ele") == 0;
274
275 if (strcmp(name, "trkpt") == 0) {
276 me->nTrkpt++;
277 while (*atts) {
278 const char* a = atts[0];
279 const char* v = atts[1];
280 if (!strcmp(a, "lat"))
281 me->lat = atof(v);
282 if (!strcmp(a, "lon"))
283 me->lon = atof(v);
284 atts += 2;
285 }
286 }
287 me->count++;
288 me->indent++;
289}
290
291static void endElement(void* userData, const char* name) {
292 auto me = static_cast<UserData*>(userData);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected