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

Function xmlParseTextDecl

ThirdParty/libxml2/vtklibxml2/parser.c:7177–7236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7175 */
7176
7177void
7178xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
7179 xmlChar *version;
7180
7181 /*
7182 * We know that '<?xml' is here.
7183 */
7184 if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
7185 SKIP(5);
7186 } else {
7187 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_STARTED, NULL);
7188 return;
7189 }
7190
7191 if (SKIP_BLANKS == 0) {
7192 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
7193 "Space needed after '<?xml'\n");
7194 }
7195
7196 /*
7197 * We may have the VersionInfo here.
7198 */
7199 version = xmlParseVersionInfo(ctxt);
7200 if (version == NULL) {
7201 version = xmlCharStrdup(XML_DEFAULT_VERSION);
7202 if (version == NULL) {
7203 xmlErrMemory(ctxt);
7204 return;
7205 }
7206 } else {
7207 if (SKIP_BLANKS == 0) {
7208 xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
7209 "Space needed here\n");
7210 }
7211 }
7212 ctxt->input->version = version;
7213
7214 /*
7215 * We must have the encoding declaration
7216 */
7217 xmlParseEncodingDecl(ctxt);
7218
7219 SKIP_BLANKS;
7220 if ((RAW == '?') && (NXT(1) == '>')) {
7221 SKIP(2);
7222 } else if (RAW == '>') {
7223 /* Deprecated old WD ... */
7224 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
7225 NEXT;
7226 } else {
7227 int c;
7228
7229 xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
7230 while ((PARSER_STOPPED(ctxt) == 0) && ((c = CUR) != 0)) {
7231 NEXT;
7232 if (c == '>')
7233 break;
7234 }

Callers 4

xmlParseExternalSubsetFunction · 0.85
xmlParsePEReferenceFunction · 0.85
xmlLoadEntityContentFunction · 0.85
xmlCtxtParseContentFunction · 0.85

Calls 5

xmlFatalErrFunction · 0.85
xmlParseVersionInfoFunction · 0.85
xmlCharStrdupFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlParseEncodingDeclFunction · 0.85

Tested by

no test coverage detected