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

Function xmlValidateAttributeValue2

ThirdParty/libxml2/vtklibxml2/valid.c:3690–3782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3688 */
3689
3690static int
3691xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
3692 const xmlChar *name, xmlAttributeType type, const xmlChar *value) {
3693 int ret = 1;
3694 switch (type) {
3695 case XML_ATTRIBUTE_IDREFS:
3696 case XML_ATTRIBUTE_IDREF:
3697 case XML_ATTRIBUTE_ID:
3698 case XML_ATTRIBUTE_NMTOKENS:
3699 case XML_ATTRIBUTE_ENUMERATION:
3700 case XML_ATTRIBUTE_NMTOKEN:
3701 case XML_ATTRIBUTE_CDATA:
3702 break;
3703 case XML_ATTRIBUTE_ENTITY: {
3704 xmlEntityPtr ent;
3705
3706 ent = xmlGetDocEntity(doc, value);
3707 /* yeah it's a bit messy... */
3708 if ((ent == NULL) && (doc->standalone == 1)) {
3709 doc->standalone = 0;
3710 ent = xmlGetDocEntity(doc, value);
3711 }
3712 if (ent == NULL) {
3713 xmlErrValidNode(ctxt, (xmlNodePtr) doc,
3714 XML_DTD_UNKNOWN_ENTITY,
3715 "ENTITY attribute %s reference an unknown entity \"%s\"\n",
3716 name, value, NULL);
3717 ret = 0;
3718 } else if (ent->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
3719 xmlErrValidNode(ctxt, (xmlNodePtr) doc,
3720 XML_DTD_ENTITY_TYPE,
3721 "ENTITY attribute %s reference an entity \"%s\" of wrong type\n",
3722 name, value, NULL);
3723 ret = 0;
3724 }
3725 break;
3726 }
3727 case XML_ATTRIBUTE_ENTITIES: {
3728 xmlChar *dup, *nam = NULL, *cur, save;
3729 xmlEntityPtr ent;
3730
3731 dup = xmlStrdup(value);
3732 if (dup == NULL) {
3733 xmlVErrMemory(ctxt);
3734 return(0);
3735 }
3736 cur = dup;
3737 while (*cur != 0) {
3738 nam = cur;
3739 while ((*cur != 0) && (!IS_BLANK_CH(*cur))) cur++;
3740 save = *cur;
3741 *cur = 0;
3742 ent = xmlGetDocEntity(doc, nam);
3743 if (ent == NULL) {
3744 xmlErrValidNode(ctxt, (xmlNodePtr) doc,
3745 XML_DTD_UNKNOWN_ENTITY,
3746 "ENTITIES attribute %s reference an unknown entity \"%s\"\n",
3747 name, nam, NULL);

Callers 3

xmlValidateOneAttributeFunction · 0.85
xmlValidateOneNamespaceFunction · 0.85

Calls 4

xmlGetDocEntityFunction · 0.85
xmlStrdupFunction · 0.85
xmlVErrMemoryFunction · 0.85
xmlGetDtdNotationDescFunction · 0.85

Tested by

no test coverage detected