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

Function htmlNodeDumpFormatOutput

ThirdParty/libxml2/vtklibxml2/HTMLtree.c:723–946  ·  view source on GitHub ↗

* htmlNodeDumpFormatOutput: * @buf: the HTML buffer output * @doc: the document * @cur: the current node * @encoding: the encoding string (unused) * @format: should formatting spaces been added * * Dump an HTML node, recursive behaviour,children are printed too. */

Source from the content-addressed store, hash-verified

721 * Dump an HTML node, recursive behaviour,children are printed too.
722 */
723void
724htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
725 xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED,
726 int format) {
727 xmlNodePtr root, parent;
728 xmlAttrPtr attr;
729 const htmlElemDesc * info;
730
731 xmlInitParser();
732
733 if ((cur == NULL) || (buf == NULL)) {
734 return;
735 }
736
737 root = cur;
738 parent = cur->parent;
739 while (1) {
740 switch (cur->type) {
741 case XML_HTML_DOCUMENT_NODE:
742 case XML_DOCUMENT_NODE:
743 if (((xmlDocPtr) cur)->intSubset != NULL) {
744 htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
745 }
746 if (cur->children != NULL) {
747 /* Always validate cur->parent when descending. */
748 if (cur->parent == parent) {
749 parent = cur;
750 cur = cur->children;
751 continue;
752 }
753 } else {
754 xmlOutputBufferWriteString(buf, "\n");
755 }
756 break;
757
758 case XML_ELEMENT_NODE:
759 /*
760 * Some users like lxml are known to pass nodes with a corrupted
761 * tree structure. Fall back to a recursive call to handle this
762 * case.
763 */
764 if ((cur->parent != parent) && (cur->children != NULL)) {
765 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
766 break;
767 }
768
769 /*
770 * Get specific HTML info for that node.
771 */
772 if (cur->ns == NULL)
773 info = htmlTagLookup(cur->name);
774 else
775 info = NULL;
776
777 xmlOutputBufferWriteString(buf, "<");
778 if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
779 xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
780 xmlOutputBufferWriteString(buf, ":");

Callers 6

htmlBufNodeDumpFormatFunction · 0.85
htmlNodeDumpFileFormatFunction · 0.85
htmlNodeDumpOutputFunction · 0.85
htmlDocContentDumpOutputFunction · 0.85

Calls 8

xmlInitParserFunction · 0.85
htmlDtdDumpOutputFunction · 0.85
htmlTagLookupFunction · 0.85
xmlNsListDumpOutputFunction · 0.85
htmlAttrDumpOutputFunction · 0.85
xmlStrcasecmpFunction · 0.85

Tested by

no test coverage detected