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

Function xmlNodeDumpOutputInternal

ThirdParty/libxml2/vtklibxml2/xmlsave.c:1090–1350  ·  view source on GitHub ↗

* xmlNodeDumpOutputInternal: * @cur: the current node * * Dump an XML node, recursive behaviour, children are printed too. */

Source from the content-addressed store, hash-verified

1088 * Dump an XML node, recursive behaviour, children are printed too.
1089 */
1090static void
1091xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
1092 int format = ctxt->format;
1093 xmlNodePtr tmp, root, unformattedNode = NULL, parent;
1094 xmlAttrPtr attr;
1095 xmlChar *start, *end;
1096 xmlOutputBufferPtr buf;
1097
1098 if (cur == NULL) return;
1099 buf = ctxt->buf;
1100
1101 root = cur;
1102 parent = cur->parent;
1103 while (1) {
1104 switch (cur->type) {
1105 case XML_DOCUMENT_NODE:
1106 case XML_HTML_DOCUMENT_NODE:
1107 xmlDocContentDumpOutput(ctxt, (xmlDocPtr) cur);
1108 break;
1109
1110 case XML_DTD_NODE:
1111 xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur);
1112 break;
1113
1114 case XML_DOCUMENT_FRAG_NODE:
1115 /* Always validate cur->parent when descending. */
1116 if ((cur->parent == parent) && (cur->children != NULL)) {
1117 parent = cur;
1118 cur = cur->children;
1119 continue;
1120 }
1121 break;
1122
1123 case XML_ELEMENT_DECL:
1124 xmlBufDumpElementDecl(buf, (xmlElementPtr) cur);
1125 break;
1126
1127 case XML_ATTRIBUTE_DECL:
1128 xmlBufDumpAttributeDecl(buf, (xmlAttributePtr) cur);
1129 break;
1130
1131 case XML_ENTITY_DECL:
1132 xmlBufDumpEntityDecl(buf, (xmlEntityPtr) cur);
1133 break;
1134
1135 case XML_ELEMENT_NODE:
1136 if ((cur != root) && (ctxt->format == 1) &&
1137 (xmlIndentTreeOutput))
1138 xmlOutputBufferWrite(buf, ctxt->indent_size *
1139 (ctxt->level > ctxt->indent_nr ?
1140 ctxt->indent_nr : ctxt->level),
1141 ctxt->indent);
1142
1143 /*
1144 * Some users like lxml are known to pass nodes with a corrupted
1145 * tree structure. Fall back to a recursive call to handle this
1146 * case.
1147 */

Callers 4

xmlDtdDumpOutputFunction · 0.85
xmlDocContentDumpOutputFunction · 0.85
xmlSaveTreeFunction · 0.85
xmlNodeDumpOutputFunction · 0.85

Calls 12

xmlDocContentDumpOutputFunction · 0.85
xmlDtdDumpOutputFunction · 0.85
xmlBufDumpElementDeclFunction · 0.85
xmlBufDumpAttributeDeclFunction · 0.85
xmlBufDumpEntityDeclFunction · 0.85
xmlOutputBufferWriteFunction · 0.85
xmlNsListDumpOutputCtxtFunction · 0.85
xmlAttrDumpOutputFunction · 0.85
xmlNsDumpOutputFunction · 0.85

Tested by

no test coverage detected