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

Function xmlParseElementMixedContentDecl

ThirdParty/libxml2/vtklibxml2/parser.c:6382–6473  ·  view source on GitHub ↗

* xmlParseElementMixedContentDecl: * @ctxt: an XML parser context * @inputchk: the input used for the current entity, needed for boundary checks * * DEPRECATED: Internal function, don't use. * * parse the declaration for a Mixed Element content * The leading '(' and spaces have been skipped in xmlParseElementContentDecl * * [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | *

Source from the content-addressed store, hash-verified

6380 * returns: the list of the xmlElementContentPtr describing the element choices
6381 */
6382xmlElementContentPtr
6383xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
6384 xmlElementContentPtr ret = NULL, cur = NULL, n;
6385 const xmlChar *elem = NULL;
6386
6387 GROW;
6388 if (CMP7(CUR_PTR, '#', 'P', 'C', 'D', 'A', 'T', 'A')) {
6389 SKIP(7);
6390 SKIP_BLANKS_PE;
6391 if (RAW == ')') {
6392 if (ctxt->input->id != inputchk) {
6393 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
6394 "Element content declaration doesn't start and"
6395 " stop in the same entity\n");
6396 }
6397 NEXT;
6398 ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA);
6399 if (ret == NULL)
6400 goto mem_error;
6401 if (RAW == '*') {
6402 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6403 NEXT;
6404 }
6405 return(ret);
6406 }
6407 if ((RAW == '(') || (RAW == '|')) {
6408 ret = cur = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA);
6409 if (ret == NULL)
6410 goto mem_error;
6411 }
6412 while ((RAW == '|') && (PARSER_STOPPED(ctxt) == 0)) {
6413 NEXT;
6414 n = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_OR);
6415 if (n == NULL)
6416 goto mem_error;
6417 if (elem == NULL) {
6418 n->c1 = cur;
6419 if (cur != NULL)
6420 cur->parent = n;
6421 ret = cur = n;
6422 } else {
6423 cur->c2 = n;
6424 n->parent = cur;
6425 n->c1 = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT);
6426 if (n->c1 == NULL)
6427 goto mem_error;
6428 n->c1->parent = n;
6429 cur = n;
6430 }
6431 SKIP_BLANKS_PE;
6432 elem = xmlParseName(ctxt);
6433 if (elem == NULL) {
6434 xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
6435 "xmlParseElementMixedContentDecl : Name expected\n");
6436 xmlFreeDocElementContent(ctxt->myDoc, ret);
6437 return(NULL);
6438 }
6439 SKIP_BLANKS_PE;

Callers 1

Calls 5

xmlNewDocElementContentFunction · 0.85
xmlParseNameFunction · 0.85
xmlFreeDocElementContentFunction · 0.85
xmlFatalErrFunction · 0.85
xmlErrMemoryFunction · 0.85

Tested by

no test coverage detected