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

Function xmlValidNormalizeAttributeValue

ThirdParty/libxml2/vtklibxml2/valid.c:3905–3940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3903 */
3904
3905xmlChar *
3906xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
3907 const xmlChar *name, const xmlChar *value) {
3908 xmlChar *ret;
3909 xmlAttributePtr attrDecl = NULL;
3910
3911 if (doc == NULL) return(NULL);
3912 if (elem == NULL) return(NULL);
3913 if (name == NULL) return(NULL);
3914 if (value == NULL) return(NULL);
3915
3916 if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) {
3917 xmlChar fn[50];
3918 xmlChar *fullname;
3919
3920 fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
3921 if (fullname == NULL)
3922 return(NULL);
3923 if ((fullname != fn) && (fullname != elem->name))
3924 xmlFree(fullname);
3925 }
3926 attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, name);
3927 if ((attrDecl == NULL) && (doc->extSubset != NULL))
3928 attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, name);
3929
3930 if (attrDecl == NULL)
3931 return(NULL);
3932 if (attrDecl->atype == XML_ATTRIBUTE_CDATA)
3933 return(NULL);
3934
3935 ret = xmlStrdup(value);
3936 if (ret == NULL)
3937 return(NULL);
3938 xmlValidNormalizeString(ret);
3939 return(ret);
3940}
3941
3942static void
3943xmlValidateAttributeIdCallback(void *payload, void *data,

Callers

nothing calls this directly

Calls 4

xmlBuildQNameFunction · 0.85
xmlGetDtdAttrDescFunction · 0.85
xmlStrdupFunction · 0.85
xmlValidNormalizeStringFunction · 0.85

Tested by

no test coverage detected