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

Function xmlSchemaCheckLanguageType

ThirdParty/libxml2/vtklibxml2/xmlschemastypes.c:2397–2424  ·  view source on GitHub ↗

* xmlSchemaCheckLanguageType * @value: the value to check * * Check that a value conforms to the lexical space of the language datatype. * Must conform to [a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})* * * Returns 1 if this validates, 0 otherwise. */

Source from the content-addressed store, hash-verified

2395 * Returns 1 if this validates, 0 otherwise.
2396 */
2397static int
2398xmlSchemaCheckLanguageType(const xmlChar* value) {
2399 int first = 1, len = 0;
2400 const xmlChar* cur = value;
2401
2402 if (value == NULL)
2403 return (0);
2404
2405 while (cur[0] != 0) {
2406 if (!( ((cur[0] >= 'a') && (cur[0] <= 'z')) || ((cur[0] >= 'A') && (cur[0] <= 'Z'))
2407 || (cur[0] == '-')
2408 || ((first == 0) && (xmlIsDigit_ch(cur[0]))) ))
2409 return (0);
2410 if (cur[0] == '-') {
2411 if ((len < 1) || (len > 8))
2412 return (0);
2413 len = 0;
2414 first = 0;
2415 }
2416 else
2417 len++;
2418 cur++;
2419 }
2420 if ((len < 1) || (len > 8))
2421 return (0);
2422
2423 return (1);
2424}
2425
2426/**
2427 * xmlSchemaValAtomicType:

Callers 1

xmlSchemaValAtomicTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected