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

Function xmlBufDumpElementContent

ThirdParty/libxml2/vtklibxml2/xmlsave.c:495–559  ·  view source on GitHub ↗

* xmlBufDumpElementContent: * @buf: output buffer * @content: element table * * This will dump the content of the element table as an XML DTD definition */

Source from the content-addressed store, hash-verified

493 * This will dump the content of the element table as an XML DTD definition
494 */
495static void
496xmlBufDumpElementContent(xmlOutputBufferPtr buf,
497 xmlElementContentPtr content) {
498 xmlElementContentPtr cur;
499
500 if (content == NULL) return;
501
502 xmlOutputBufferWrite(buf, 1, "(");
503 cur = content;
504
505 do {
506 if (cur == NULL) return;
507
508 switch (cur->type) {
509 case XML_ELEMENT_CONTENT_PCDATA:
510 xmlOutputBufferWrite(buf, 7, "#PCDATA");
511 break;
512 case XML_ELEMENT_CONTENT_ELEMENT:
513 if (cur->prefix != NULL) {
514 xmlOutputBufferWriteString(buf,
515 (const char *) cur->prefix);
516 xmlOutputBufferWrite(buf, 1, ":");
517 }
518 xmlOutputBufferWriteString(buf, (const char *) cur->name);
519 break;
520 case XML_ELEMENT_CONTENT_SEQ:
521 case XML_ELEMENT_CONTENT_OR:
522 if ((cur != content) &&
523 (cur->parent != NULL) &&
524 ((cur->type != cur->parent->type) ||
525 (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
526 xmlOutputBufferWrite(buf, 1, "(");
527 cur = cur->c1;
528 continue;
529 }
530
531 while (cur != content) {
532 xmlElementContentPtr parent = cur->parent;
533
534 if (parent == NULL) return;
535
536 if (((cur->type == XML_ELEMENT_CONTENT_OR) ||
537 (cur->type == XML_ELEMENT_CONTENT_SEQ)) &&
538 ((cur->type != parent->type) ||
539 (cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
540 xmlOutputBufferWrite(buf, 1, ")");
541 xmlBufDumpElementOccur(buf, cur);
542
543 if (cur == parent->c1) {
544 if (parent->type == XML_ELEMENT_CONTENT_SEQ)
545 xmlOutputBufferWrite(buf, 3, " , ");
546 else if (parent->type == XML_ELEMENT_CONTENT_OR)
547 xmlOutputBufferWrite(buf, 3, " | ");
548
549 cur = parent->c2;
550 break;
551 }
552

Callers 1

xmlBufDumpElementDeclFunction · 0.85

Calls 3

xmlOutputBufferWriteFunction · 0.85
xmlBufDumpElementOccurFunction · 0.85

Tested by

no test coverage detected