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

Function htmlParsePubidLiteral

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:2932–2980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2930 */
2931
2932static xmlChar *
2933htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
2934 size_t len = 0, startPosition = 0;
2935 int err = 0;
2936 int quote;
2937 xmlChar *ret = NULL;
2938
2939 if ((CUR != '"') && (CUR != '\'')) {
2940 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED,
2941 "PubidLiteral \" or ' expected\n", NULL, NULL);
2942 return(NULL);
2943 }
2944 quote = CUR;
2945 NEXT;
2946
2947 /*
2948 * Name ::= (Letter | '_') (NameChar)*
2949 */
2950 if (CUR_PTR < BASE_PTR)
2951 return(ret);
2952 startPosition = CUR_PTR - BASE_PTR;
2953
2954 while ((PARSER_STOPPED(ctxt) == 0) &&
2955 (CUR != 0) && (CUR != quote)) {
2956 if (!IS_PUBIDCHAR_CH(CUR)) {
2957 htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
2958 "Invalid char in PubidLiteral 0x%X\n", CUR);
2959 err = 1;
2960 }
2961 len++;
2962 NEXT;
2963 }
2964
2965 if (CUR != quote) {
2966 htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
2967 "Unfinished PubidLiteral\n", NULL, NULL);
2968 } else {
2969 if (err == 0) {
2970 ret = xmlStrndup((BASE_PTR + startPosition), len);
2971 if (ret == NULL) {
2972 htmlErrMemory(ctxt);
2973 return(NULL);
2974 }
2975 }
2976 NEXT;
2977 }
2978
2979 return(ret);
2980}
2981
2982/**
2983 * htmlParseScript:

Callers 1

htmlParseExternalIDFunction · 0.85

Calls 2

xmlStrndupFunction · 0.85
htmlErrMemoryFunction · 0.85

Tested by

no test coverage detected