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

Function xmlSplitQName4

ThirdParty/libxml2/vtklibxml2/tree.c:306–339  ·  view source on GitHub ↗

* xmlSplitQName4: * @name: the full QName * @prefixPtr: pointer to resulting prefix * * Parse a QName. The return value points to the start of the local * name in the input string. If the QName has a prefix, it will be * allocated and stored in @prefixPtr. This string must be freed by * the caller. If there's no prefix, @prefixPtr is set to NULL. * * Returns the local name or NULL if a

Source from the content-addressed store, hash-verified

304 * Returns the local name or NULL if a memory allocation failed.
305 */
306const xmlChar *
307xmlSplitQName4(const xmlChar *name, xmlChar **prefixPtr) {
308 xmlChar *prefix;
309 int l = 0;
310
311 if ((name == NULL) || (prefixPtr == NULL))
312 return(NULL);
313
314 *prefixPtr = NULL;
315
316 /* nasty but valid */
317 if (name[0] == ':')
318 return(name);
319
320 /*
321 * we are not trying to validate but just to cut, and yes it will
322 * work even if this is as set of UTF-8 encoded chars
323 */
324 while ((name[l] != 0) && (name[l] != ':'))
325 l++;
326
327 /*
328 * TODO: What about names with multiple colons?
329 */
330 if ((name[l] == 0) || (name[l+1] == 0))
331 return(name);
332
333 prefix = xmlStrndup(name, l);
334 if (prefix == NULL)
335 return(NULL);
336
337 *prefixPtr = prefix;
338 return(&name[l+1]);
339}
340
341/************************************************************************
342 * *

Callers 11

xmlAddElementDeclFunction · 0.85
xmlGetDtdElementDescFunction · 0.85
xmlGetDtdElementDesc2Function · 0.85
xmlGetDtdAttrDescFunction · 0.85
xmlValidateAttributeDeclFunction · 0.85
xmlValidateElementDeclFunction · 0.85
xmlSetPropFunction · 0.85

Calls 1

xmlStrndupFunction · 0.85

Tested by

no test coverage detected