Lines Matching +full:- +full:- +full:output
38 FILE *output; /* the output file */ member
57 ctxt->depth = 0; in xmlCtxtDumpInitCtxt()
58 ctxt->check = 0; in xmlCtxtDumpInitCtxt()
59 ctxt->errors = 0; in xmlCtxtDumpInitCtxt()
60 ctxt->output = stdout; in xmlCtxtDumpInitCtxt()
61 ctxt->doc = NULL; in xmlCtxtDumpInitCtxt()
62 ctxt->node = NULL; in xmlCtxtDumpInitCtxt()
63 ctxt->dict = NULL; in xmlCtxtDumpInitCtxt()
64 ctxt->nodict = 0; in xmlCtxtDumpInitCtxt()
65 ctxt->options = 0; in xmlCtxtDumpInitCtxt()
67 ctxt->shift[i] = ' '; in xmlCtxtDumpInitCtxt()
68 ctxt->shift[100] = 0; in xmlCtxtDumpInitCtxt()
84 * Returns 1 if in scope, -1 in case of argument error,
85 * -2 if the namespace is not in scope, and -3 if not on
94 return(-1); in xmlNsCheckScope()
96 if ((node->type != XML_ELEMENT_NODE) && in xmlNsCheckScope()
97 (node->type != XML_ATTRIBUTE_NODE) && in xmlNsCheckScope()
98 (node->type != XML_DOCUMENT_NODE) && in xmlNsCheckScope()
99 (node->type != XML_TEXT_NODE) && in xmlNsCheckScope()
100 (node->type != XML_HTML_DOCUMENT_NODE) && in xmlNsCheckScope()
101 (node->type != XML_XINCLUDE_START)) in xmlNsCheckScope()
102 return(-2); in xmlNsCheckScope()
105 ((node->type == XML_ELEMENT_NODE) || in xmlNsCheckScope()
106 (node->type == XML_ATTRIBUTE_NODE) || in xmlNsCheckScope()
107 (node->type == XML_TEXT_NODE) || in xmlNsCheckScope()
108 (node->type == XML_XINCLUDE_START))) { in xmlNsCheckScope()
109 if ((node->type == XML_ELEMENT_NODE) || in xmlNsCheckScope()
110 (node->type == XML_XINCLUDE_START)) { in xmlNsCheckScope()
111 cur = node->nsDef; in xmlNsCheckScope()
115 if (xmlStrEqual(cur->prefix, ns->prefix)) in xmlNsCheckScope()
116 return(-2); in xmlNsCheckScope()
117 cur = cur->next; in xmlNsCheckScope()
120 node = node->parent; in xmlNsCheckScope()
124 ((node->type == XML_DOCUMENT_NODE) || in xmlNsCheckScope()
125 (node->type == XML_HTML_DOCUMENT_NODE))) { in xmlNsCheckScope()
126 xmlNsPtr oldNs = ((xmlDocPtr) node)->oldNs; in xmlNsCheckScope()
130 return(-3); in xmlNsCheckScope()
136 if (ctxt->check) in xmlCtxtDumpSpaces()
138 if ((ctxt->output != NULL) && (ctxt->depth > 0)) { in xmlCtxtDumpSpaces()
139 if (ctxt->depth < 50) in xmlCtxtDumpSpaces()
140 fprintf(ctxt->output, "%s", &ctxt->shift[100 - 2 * ctxt->depth]); in xmlCtxtDumpSpaces()
142 fprintf(ctxt->output, "%s", ctxt->shift); in xmlCtxtDumpSpaces()
156 ctxt->errors++; in xmlDebugErr()
157 fprintf(ctxt->output, "ERROR %d: %s", error, msg); in xmlDebugErr()
162 ctxt->errors++; in xmlDebugErr2()
163 fprintf(ctxt->output, "ERROR %d: ", error); in xmlDebugErr2()
164 fprintf(ctxt->output, msg, extra); in xmlDebugErr2()
169 ctxt->errors++; in xmlDebugErr3()
170 fprintf(ctxt->output, "ERROR %d: ", error); in xmlDebugErr3()
171 fprintf(ctxt->output, msg, extra); in xmlDebugErr3()
188 if (ret == -2) { in xmlCtxtNsCheckScope()
189 if (ns->prefix == NULL) in xmlCtxtNsCheckScope()
195 (char *) ns->prefix); in xmlCtxtNsCheckScope()
197 if (ret == -3) { in xmlCtxtNsCheckScope()
198 if (ns->prefix == NULL) in xmlCtxtNsCheckScope()
204 (char *) ns->prefix); in xmlCtxtNsCheckScope()
213 * Do debugging on the string, currently it just checks the UTF-8 content
219 if (ctxt->check) { in xmlCtxtCheckString()
222 "String is not UTF-8 %s", (const char *) str); in xmlCtxtCheckString()
238 if (ctxt->check) { in xmlCtxtCheckName()
249 if ((ctxt->dict != NULL) && in xmlCtxtCheckName()
250 (!xmlDictOwns(ctxt->dict, name)) && in xmlCtxtCheckName()
251 ((ctxt->doc == NULL) || in xmlCtxtCheckName()
252 ((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0))) { in xmlCtxtCheckName()
265 doc = node->doc; in xmlCtxtGenericNodeCheck()
267 if (node->parent == NULL) in xmlCtxtGenericNodeCheck()
270 if (node->doc == NULL) { in xmlCtxtGenericNodeCheck()
275 dict = doc->dict; in xmlCtxtGenericNodeCheck()
276 if ((dict == NULL) && (ctxt->nodict == 0)) { in xmlCtxtGenericNodeCheck()
279 if (doc->type == XML_DOCUMENT_NODE) in xmlCtxtGenericNodeCheck()
283 ctxt->nodict = 1; in xmlCtxtGenericNodeCheck()
285 if (ctxt->doc == NULL) in xmlCtxtGenericNodeCheck()
286 ctxt->doc = doc; in xmlCtxtGenericNodeCheck()
288 if (ctxt->dict == NULL) { in xmlCtxtGenericNodeCheck()
289 ctxt->dict = dict; in xmlCtxtGenericNodeCheck()
292 if ((node->parent != NULL) && (node->doc != node->parent->doc) && in xmlCtxtGenericNodeCheck()
293 (!xmlStrEqual(node->name, BAD_CAST "pseudoroot"))) in xmlCtxtGenericNodeCheck()
296 if (node->prev == NULL) { in xmlCtxtGenericNodeCheck()
297 if (node->type == XML_ATTRIBUTE_NODE) { in xmlCtxtGenericNodeCheck()
298 if ((node->parent != NULL) && in xmlCtxtGenericNodeCheck()
299 (node != (xmlNodePtr) node->parent->properties)) in xmlCtxtGenericNodeCheck()
303 } else if ((node->parent != NULL) && (node->parent->children != node)) in xmlCtxtGenericNodeCheck()
307 if (node->prev->next != node) in xmlCtxtGenericNodeCheck()
309 "Node prev->next : back link wrong\n"); in xmlCtxtGenericNodeCheck()
311 if (node->next == NULL) { in xmlCtxtGenericNodeCheck()
312 if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) && in xmlCtxtGenericNodeCheck()
313 (node->parent->last != node) && in xmlCtxtGenericNodeCheck()
314 (node->parent->type == XML_ELEMENT_NODE)) in xmlCtxtGenericNodeCheck()
318 if (node->next->prev != node) in xmlCtxtGenericNodeCheck()
320 "Node next->prev : forward link wrong\n"); in xmlCtxtGenericNodeCheck()
321 if (node->next->parent != node->parent) in xmlCtxtGenericNodeCheck()
323 "Node next->prev : forward link wrong\n"); in xmlCtxtGenericNodeCheck()
325 if (node->type == XML_ELEMENT_NODE) { in xmlCtxtGenericNodeCheck()
328 ns = node->nsDef; in xmlCtxtGenericNodeCheck()
331 ns = ns->next; in xmlCtxtGenericNodeCheck()
333 if (node->ns != NULL) in xmlCtxtGenericNodeCheck()
334 xmlCtxtNsCheckScope(ctxt, node, node->ns); in xmlCtxtGenericNodeCheck()
335 } else if (node->type == XML_ATTRIBUTE_NODE) { in xmlCtxtGenericNodeCheck()
336 if (node->ns != NULL) in xmlCtxtGenericNodeCheck()
337 xmlCtxtNsCheckScope(ctxt, node, node->ns); in xmlCtxtGenericNodeCheck()
340 if ((node->type != XML_ELEMENT_NODE) && in xmlCtxtGenericNodeCheck()
341 (node->type != XML_ATTRIBUTE_NODE) && in xmlCtxtGenericNodeCheck()
342 (node->type != XML_ELEMENT_DECL) && in xmlCtxtGenericNodeCheck()
343 (node->type != XML_ATTRIBUTE_DECL) && in xmlCtxtGenericNodeCheck()
344 (node->type != XML_DTD_NODE) && in xmlCtxtGenericNodeCheck()
345 (node->type != XML_HTML_DOCUMENT_NODE) && in xmlCtxtGenericNodeCheck()
346 (node->type != XML_DOCUMENT_NODE)) { in xmlCtxtGenericNodeCheck()
347 if (node->content != NULL) in xmlCtxtGenericNodeCheck()
348 xmlCtxtCheckString(ctxt, (const xmlChar *) node->content); in xmlCtxtGenericNodeCheck()
350 switch (node->type) { in xmlCtxtGenericNodeCheck()
353 xmlCtxtCheckName(ctxt, node->name); in xmlCtxtGenericNodeCheck()
356 if ((node->name == xmlStringText) || in xmlCtxtGenericNodeCheck()
357 (node->name == xmlStringTextNoenc)) in xmlCtxtGenericNodeCheck()
360 if ((ctxt->dict != NULL) && in xmlCtxtGenericNodeCheck()
361 (node->name == xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", in xmlCtxtGenericNodeCheck()
367 (const char *) node->name); in xmlCtxtGenericNodeCheck()
370 if (node->name == xmlStringComment) in xmlCtxtGenericNodeCheck()
374 (const char *) node->name); in xmlCtxtGenericNodeCheck()
377 xmlCtxtCheckName(ctxt, node->name); in xmlCtxtGenericNodeCheck()
380 if (node->name == NULL) in xmlCtxtGenericNodeCheck()
384 (const char *) node->name); in xmlCtxtGenericNodeCheck()
409 if (ctxt->check) { in xmlCtxtDumpString()
414 fprintf(ctxt->output, "(NULL)"); in xmlCtxtDumpString()
421 fputc(' ', ctxt->output); in xmlCtxtDumpString()
423 fprintf(ctxt->output, "#%X", str[i]); in xmlCtxtDumpString()
425 fputc(str[i], ctxt->output); in xmlCtxtDumpString()
426 fprintf(ctxt->output, "..."); in xmlCtxtDumpString()
435 if (!ctxt->check) in xmlCtxtDumpDtdNode()
436 fprintf(ctxt->output, "DTD node is NULL\n"); in xmlCtxtDumpDtdNode()
440 if (dtd->type != XML_DTD_NODE) { in xmlCtxtDumpDtdNode()
445 if (!ctxt->check) { in xmlCtxtDumpDtdNode()
446 if (dtd->name != NULL) in xmlCtxtDumpDtdNode()
447 fprintf(ctxt->output, "DTD(%s)", (char *) dtd->name); in xmlCtxtDumpDtdNode()
449 fprintf(ctxt->output, "DTD"); in xmlCtxtDumpDtdNode()
450 if (dtd->ExternalID != NULL) in xmlCtxtDumpDtdNode()
451 fprintf(ctxt->output, ", PUBLIC %s", (char *) dtd->ExternalID); in xmlCtxtDumpDtdNode()
452 if (dtd->SystemID != NULL) in xmlCtxtDumpDtdNode()
453 fprintf(ctxt->output, ", SYSTEM %s", (char *) dtd->SystemID); in xmlCtxtDumpDtdNode()
454 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDtdNode()
468 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
469 fprintf(ctxt->output, "Attribute declaration is NULL\n"); in xmlCtxtDumpAttrDecl()
472 if (attr->type != XML_ATTRIBUTE_DECL) { in xmlCtxtDumpAttrDecl()
477 if (attr->name != NULL) { in xmlCtxtDumpAttrDecl()
478 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
479 fprintf(ctxt->output, "ATTRDECL(%s)", (char *) attr->name); in xmlCtxtDumpAttrDecl()
483 if (attr->elem != NULL) { in xmlCtxtDumpAttrDecl()
484 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
485 fprintf(ctxt->output, " for %s", (char *) attr->elem); in xmlCtxtDumpAttrDecl()
489 if (!ctxt->check) { in xmlCtxtDumpAttrDecl()
490 switch (attr->atype) { in xmlCtxtDumpAttrDecl()
492 fprintf(ctxt->output, " CDATA"); in xmlCtxtDumpAttrDecl()
495 fprintf(ctxt->output, " ID"); in xmlCtxtDumpAttrDecl()
498 fprintf(ctxt->output, " IDREF"); in xmlCtxtDumpAttrDecl()
501 fprintf(ctxt->output, " IDREFS"); in xmlCtxtDumpAttrDecl()
504 fprintf(ctxt->output, " ENTITY"); in xmlCtxtDumpAttrDecl()
507 fprintf(ctxt->output, " ENTITIES"); in xmlCtxtDumpAttrDecl()
510 fprintf(ctxt->output, " NMTOKEN"); in xmlCtxtDumpAttrDecl()
513 fprintf(ctxt->output, " NMTOKENS"); in xmlCtxtDumpAttrDecl()
516 fprintf(ctxt->output, " ENUMERATION"); in xmlCtxtDumpAttrDecl()
519 fprintf(ctxt->output, " NOTATION "); in xmlCtxtDumpAttrDecl()
522 if (attr->tree != NULL) { in xmlCtxtDumpAttrDecl()
524 xmlEnumerationPtr cur = attr->tree; in xmlCtxtDumpAttrDecl()
528 fprintf(ctxt->output, "|%s", (char *) cur->name); in xmlCtxtDumpAttrDecl()
530 fprintf(ctxt->output, " (%s", (char *) cur->name); in xmlCtxtDumpAttrDecl()
531 cur = cur->next; in xmlCtxtDumpAttrDecl()
536 fprintf(ctxt->output, ")"); in xmlCtxtDumpAttrDecl()
538 fprintf(ctxt->output, "...)"); in xmlCtxtDumpAttrDecl()
540 switch (attr->def) { in xmlCtxtDumpAttrDecl()
544 fprintf(ctxt->output, " REQUIRED"); in xmlCtxtDumpAttrDecl()
547 fprintf(ctxt->output, " IMPLIED"); in xmlCtxtDumpAttrDecl()
550 fprintf(ctxt->output, " FIXED"); in xmlCtxtDumpAttrDecl()
553 if (attr->defaultValue != NULL) { in xmlCtxtDumpAttrDecl()
554 fprintf(ctxt->output, "\""); in xmlCtxtDumpAttrDecl()
555 xmlCtxtDumpString(ctxt, attr->defaultValue); in xmlCtxtDumpAttrDecl()
556 fprintf(ctxt->output, "\""); in xmlCtxtDumpAttrDecl()
558 fprintf(ctxt->output, "\n"); in xmlCtxtDumpAttrDecl()
573 if (!ctxt->check) in xmlCtxtDumpElemDecl()
574 fprintf(ctxt->output, "Element declaration is NULL\n"); in xmlCtxtDumpElemDecl()
577 if (elem->type != XML_ELEMENT_DECL) { in xmlCtxtDumpElemDecl()
582 if (elem->name != NULL) { in xmlCtxtDumpElemDecl()
583 if (!ctxt->check) { in xmlCtxtDumpElemDecl()
584 fprintf(ctxt->output, "ELEMDECL("); in xmlCtxtDumpElemDecl()
585 xmlCtxtDumpString(ctxt, elem->name); in xmlCtxtDumpElemDecl()
586 fprintf(ctxt->output, ")"); in xmlCtxtDumpElemDecl()
591 if (!ctxt->check) { in xmlCtxtDumpElemDecl()
592 switch (elem->etype) { in xmlCtxtDumpElemDecl()
594 fprintf(ctxt->output, ", UNDEFINED"); in xmlCtxtDumpElemDecl()
597 fprintf(ctxt->output, ", EMPTY"); in xmlCtxtDumpElemDecl()
600 fprintf(ctxt->output, ", ANY"); in xmlCtxtDumpElemDecl()
603 fprintf(ctxt->output, ", MIXED "); in xmlCtxtDumpElemDecl()
606 fprintf(ctxt->output, ", MIXED "); in xmlCtxtDumpElemDecl()
609 if ((elem->type != XML_ELEMENT_NODE) && (elem->content != NULL)) { in xmlCtxtDumpElemDecl()
613 xmlSnprintfElementContent(buf, 5000, elem->content, 1); in xmlCtxtDumpElemDecl()
615 fprintf(ctxt->output, "%s", buf); in xmlCtxtDumpElemDecl()
617 fprintf(ctxt->output, "\n"); in xmlCtxtDumpElemDecl()
632 if (!ctxt->check) in xmlCtxtDumpEntityDecl()
633 fprintf(ctxt->output, "Entity declaration is NULL\n"); in xmlCtxtDumpEntityDecl()
636 if (ent->type != XML_ENTITY_DECL) { in xmlCtxtDumpEntityDecl()
641 if (ent->name != NULL) { in xmlCtxtDumpEntityDecl()
642 if (!ctxt->check) { in xmlCtxtDumpEntityDecl()
643 fprintf(ctxt->output, "ENTITYDECL("); in xmlCtxtDumpEntityDecl()
644 xmlCtxtDumpString(ctxt, ent->name); in xmlCtxtDumpEntityDecl()
645 fprintf(ctxt->output, ")"); in xmlCtxtDumpEntityDecl()
650 if (!ctxt->check) { in xmlCtxtDumpEntityDecl()
651 switch (ent->etype) { in xmlCtxtDumpEntityDecl()
653 fprintf(ctxt->output, ", internal\n"); in xmlCtxtDumpEntityDecl()
656 fprintf(ctxt->output, ", external parsed\n"); in xmlCtxtDumpEntityDecl()
659 fprintf(ctxt->output, ", unparsed\n"); in xmlCtxtDumpEntityDecl()
662 fprintf(ctxt->output, ", parameter\n"); in xmlCtxtDumpEntityDecl()
665 fprintf(ctxt->output, ", external parameter\n"); in xmlCtxtDumpEntityDecl()
668 fprintf(ctxt->output, ", predefined\n"); in xmlCtxtDumpEntityDecl()
671 if (ent->ExternalID) { in xmlCtxtDumpEntityDecl()
673 fprintf(ctxt->output, " ExternalID=%s\n", in xmlCtxtDumpEntityDecl()
674 (char *) ent->ExternalID); in xmlCtxtDumpEntityDecl()
676 if (ent->SystemID) { in xmlCtxtDumpEntityDecl()
678 fprintf(ctxt->output, " SystemID=%s\n", in xmlCtxtDumpEntityDecl()
679 (char *) ent->SystemID); in xmlCtxtDumpEntityDecl()
681 if (ent->URI != NULL) { in xmlCtxtDumpEntityDecl()
683 fprintf(ctxt->output, " URI=%s\n", (char *) ent->URI); in xmlCtxtDumpEntityDecl()
685 if (ent->content) { in xmlCtxtDumpEntityDecl()
687 fprintf(ctxt->output, " content="); in xmlCtxtDumpEntityDecl()
688 xmlCtxtDumpString(ctxt, ent->content); in xmlCtxtDumpEntityDecl()
689 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntityDecl()
705 if (!ctxt->check) in xmlCtxtDumpNamespace()
706 fprintf(ctxt->output, "namespace node is NULL\n"); in xmlCtxtDumpNamespace()
709 if (ns->type != XML_NAMESPACE_DECL) { in xmlCtxtDumpNamespace()
714 if (ns->href == NULL) { in xmlCtxtDumpNamespace()
715 if (ns->prefix != NULL) in xmlCtxtDumpNamespace()
718 (char *) ns->prefix); in xmlCtxtDumpNamespace()
723 if (!ctxt->check) { in xmlCtxtDumpNamespace()
724 if (ns->prefix != NULL) in xmlCtxtDumpNamespace()
725 fprintf(ctxt->output, "namespace %s href=", in xmlCtxtDumpNamespace()
726 (char *) ns->prefix); in xmlCtxtDumpNamespace()
728 fprintf(ctxt->output, "default namespace href="); in xmlCtxtDumpNamespace()
730 xmlCtxtDumpString(ctxt, ns->href); in xmlCtxtDumpNamespace()
731 fprintf(ctxt->output, "\n"); in xmlCtxtDumpNamespace()
741 ns = ns->next; in xmlCtxtDumpNamespaceList()
751 if (!ctxt->check) in xmlCtxtDumpEntity()
752 fprintf(ctxt->output, "Entity is NULL\n"); in xmlCtxtDumpEntity()
755 if (!ctxt->check) { in xmlCtxtDumpEntity()
756 switch (ent->etype) { in xmlCtxtDumpEntity()
758 fprintf(ctxt->output, "INTERNAL_GENERAL_ENTITY "); in xmlCtxtDumpEntity()
761 fprintf(ctxt->output, "EXTERNAL_GENERAL_PARSED_ENTITY "); in xmlCtxtDumpEntity()
764 fprintf(ctxt->output, "EXTERNAL_GENERAL_UNPARSED_ENTITY "); in xmlCtxtDumpEntity()
767 fprintf(ctxt->output, "INTERNAL_PARAMETER_ENTITY "); in xmlCtxtDumpEntity()
770 fprintf(ctxt->output, "EXTERNAL_PARAMETER_ENTITY "); in xmlCtxtDumpEntity()
773 fprintf(ctxt->output, "ENTITY_%d ! ", (int) ent->etype); in xmlCtxtDumpEntity()
775 fprintf(ctxt->output, "%s\n", ent->name); in xmlCtxtDumpEntity()
776 if (ent->ExternalID) { in xmlCtxtDumpEntity()
778 fprintf(ctxt->output, "ExternalID=%s\n", in xmlCtxtDumpEntity()
779 (char *) ent->ExternalID); in xmlCtxtDumpEntity()
781 if (ent->SystemID) { in xmlCtxtDumpEntity()
783 fprintf(ctxt->output, "SystemID=%s\n", (char *) ent->SystemID); in xmlCtxtDumpEntity()
785 if (ent->URI) { in xmlCtxtDumpEntity()
787 fprintf(ctxt->output, "URI=%s\n", (char *) ent->URI); in xmlCtxtDumpEntity()
789 if (ent->content) { in xmlCtxtDumpEntity()
791 fprintf(ctxt->output, "content="); in xmlCtxtDumpEntity()
792 xmlCtxtDumpString(ctxt, ent->content); in xmlCtxtDumpEntity()
793 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntity()
800 * @output: the FILE * for the output
812 if (!ctxt->check) in xmlCtxtDumpAttr()
813 fprintf(ctxt->output, "Attr is NULL"); in xmlCtxtDumpAttr()
816 if (!ctxt->check) { in xmlCtxtDumpAttr()
817 fprintf(ctxt->output, "ATTRIBUTE "); in xmlCtxtDumpAttr()
818 xmlCtxtDumpString(ctxt, attr->name); in xmlCtxtDumpAttr()
819 fprintf(ctxt->output, "\n"); in xmlCtxtDumpAttr()
820 if (attr->children != NULL) { in xmlCtxtDumpAttr()
821 ctxt->depth++; in xmlCtxtDumpAttr()
822 xmlCtxtDumpNodeList(ctxt, attr->children); in xmlCtxtDumpAttr()
823 ctxt->depth--; in xmlCtxtDumpAttr()
826 if (attr->name == NULL) in xmlCtxtDumpAttr()
838 * @output: the FILE * for the output
849 attr = attr->next; in xmlCtxtDumpAttrList()
855 * @output: the FILE * for the output
865 if (!ctxt->check) { in xmlCtxtDumpOneNode()
867 fprintf(ctxt->output, "node is NULL\n"); in xmlCtxtDumpOneNode()
871 ctxt->node = node; in xmlCtxtDumpOneNode()
873 switch (node->type) { in xmlCtxtDumpOneNode()
875 if (!ctxt->check) { in xmlCtxtDumpOneNode()
877 fprintf(ctxt->output, "ELEMENT "); in xmlCtxtDumpOneNode()
878 if ((node->ns != NULL) && (node->ns->prefix != NULL)) { in xmlCtxtDumpOneNode()
879 xmlCtxtDumpString(ctxt, node->ns->prefix); in xmlCtxtDumpOneNode()
880 fprintf(ctxt->output, ":"); in xmlCtxtDumpOneNode()
882 xmlCtxtDumpString(ctxt, node->name); in xmlCtxtDumpOneNode()
883 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
887 if (!ctxt->check) in xmlCtxtDumpOneNode()
889 fprintf(ctxt->output, "Error, ATTRIBUTE found here\n"); in xmlCtxtDumpOneNode()
893 if (!ctxt->check) { in xmlCtxtDumpOneNode()
895 if (node->name == (const xmlChar *) xmlStringTextNoenc) in xmlCtxtDumpOneNode()
896 fprintf(ctxt->output, "TEXT no enc"); in xmlCtxtDumpOneNode()
898 fprintf(ctxt->output, "TEXT"); in xmlCtxtDumpOneNode()
899 if (ctxt->options & DUMP_TEXT_TYPE) { in xmlCtxtDumpOneNode()
900 if (node->content == (xmlChar *) &(node->properties)) in xmlCtxtDumpOneNode()
901 fprintf(ctxt->output, " compact\n"); in xmlCtxtDumpOneNode()
902 else if (xmlDictOwns(ctxt->dict, node->content) == 1) in xmlCtxtDumpOneNode()
903 fprintf(ctxt->output, " interned\n"); in xmlCtxtDumpOneNode()
905 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
907 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
911 if (!ctxt->check) { in xmlCtxtDumpOneNode()
913 fprintf(ctxt->output, "CDATA_SECTION\n"); in xmlCtxtDumpOneNode()
917 if (!ctxt->check) { in xmlCtxtDumpOneNode()
919 fprintf(ctxt->output, "ENTITY_REF(%s)\n", in xmlCtxtDumpOneNode()
920 (char *) node->name); in xmlCtxtDumpOneNode()
924 if (!ctxt->check) { in xmlCtxtDumpOneNode()
926 fprintf(ctxt->output, "ENTITY\n"); in xmlCtxtDumpOneNode()
930 if (!ctxt->check) { in xmlCtxtDumpOneNode()
932 fprintf(ctxt->output, "PI %s\n", (char *) node->name); in xmlCtxtDumpOneNode()
936 if (!ctxt->check) { in xmlCtxtDumpOneNode()
938 fprintf(ctxt->output, "COMMENT\n"); in xmlCtxtDumpOneNode()
943 if (!ctxt->check) { in xmlCtxtDumpOneNode()
946 fprintf(ctxt->output, "Error, DOCUMENT found here\n"); in xmlCtxtDumpOneNode()
950 if (!ctxt->check) { in xmlCtxtDumpOneNode()
952 fprintf(ctxt->output, "DOCUMENT_TYPE\n"); in xmlCtxtDumpOneNode()
956 if (!ctxt->check) { in xmlCtxtDumpOneNode()
958 fprintf(ctxt->output, "DOCUMENT_FRAG\n"); in xmlCtxtDumpOneNode()
962 if (!ctxt->check) { in xmlCtxtDumpOneNode()
964 fprintf(ctxt->output, "NOTATION\n"); in xmlCtxtDumpOneNode()
983 if (!ctxt->check) { in xmlCtxtDumpOneNode()
985 fprintf(ctxt->output, "INCLUDE START\n"); in xmlCtxtDumpOneNode()
989 if (!ctxt->check) { in xmlCtxtDumpOneNode()
991 fprintf(ctxt->output, "INCLUDE END\n"); in xmlCtxtDumpOneNode()
995 if (!ctxt->check) in xmlCtxtDumpOneNode()
998 "Unknown node type %d\n", node->type); in xmlCtxtDumpOneNode()
1001 if (node->doc == NULL) { in xmlCtxtDumpOneNode()
1002 if (!ctxt->check) { in xmlCtxtDumpOneNode()
1005 fprintf(ctxt->output, "PBM: doc == NULL !!!\n"); in xmlCtxtDumpOneNode()
1007 ctxt->depth++; in xmlCtxtDumpOneNode()
1008 if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL)) in xmlCtxtDumpOneNode()
1009 xmlCtxtDumpNamespaceList(ctxt, node->nsDef); in xmlCtxtDumpOneNode()
1010 if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL)) in xmlCtxtDumpOneNode()
1011 xmlCtxtDumpAttrList(ctxt, node->properties); in xmlCtxtDumpOneNode()
1012 if (node->type != XML_ENTITY_REF_NODE) { in xmlCtxtDumpOneNode()
1013 if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) { in xmlCtxtDumpOneNode()
1014 if (!ctxt->check) { in xmlCtxtDumpOneNode()
1016 fprintf(ctxt->output, "content="); in xmlCtxtDumpOneNode()
1017 xmlCtxtDumpString(ctxt, node->content); in xmlCtxtDumpOneNode()
1018 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
1024 ent = xmlGetDocEntity(node->doc, node->name); in xmlCtxtDumpOneNode()
1028 ctxt->depth--; in xmlCtxtDumpOneNode()
1038 * @output: the FILE * for the output
1048 if (!ctxt->check) { in xmlCtxtDumpNode()
1050 fprintf(ctxt->output, "node is NULL\n"); in xmlCtxtDumpNode()
1055 if ((node->type != XML_NAMESPACE_DECL) && in xmlCtxtDumpNode()
1056 (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) { in xmlCtxtDumpNode()
1057 ctxt->depth++; in xmlCtxtDumpNode()
1058 xmlCtxtDumpNodeList(ctxt, node->children); in xmlCtxtDumpNode()
1059 ctxt->depth--; in xmlCtxtDumpNode()
1065 * @output: the FILE * for the output
1076 node = node->next; in xmlCtxtDumpNodeList()
1084 if (!ctxt->check) in xmlCtxtDumpDocHead()
1085 fprintf(ctxt->output, "DOCUMENT == NULL !\n"); in xmlCtxtDumpDocHead()
1088 ctxt->node = (xmlNodePtr) doc; in xmlCtxtDumpDocHead()
1090 switch (doc->type) { in xmlCtxtDumpDocHead()
1124 if (!ctxt->check) in xmlCtxtDumpDocHead()
1125 fprintf(ctxt->output, "DOCUMENT\n"); in xmlCtxtDumpDocHead()
1128 if (!ctxt->check) in xmlCtxtDumpDocHead()
1129 fprintf(ctxt->output, "HTML DOCUMENT\n"); in xmlCtxtDumpDocHead()
1145 "Unknown node type %d\n", doc->type); in xmlCtxtDumpDocHead()
1151 * @output: the FILE * for the output
1161 if (!ctxt->check) { in xmlCtxtDumpDocumentHead()
1162 if (doc->name != NULL) { in xmlCtxtDumpDocumentHead()
1163 fprintf(ctxt->output, "name="); in xmlCtxtDumpDocumentHead()
1164 xmlCtxtDumpString(ctxt, BAD_CAST doc->name); in xmlCtxtDumpDocumentHead()
1165 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1167 if (doc->version != NULL) { in xmlCtxtDumpDocumentHead()
1168 fprintf(ctxt->output, "version="); in xmlCtxtDumpDocumentHead()
1169 xmlCtxtDumpString(ctxt, doc->version); in xmlCtxtDumpDocumentHead()
1170 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1172 if (doc->encoding != NULL) { in xmlCtxtDumpDocumentHead()
1173 fprintf(ctxt->output, "encoding="); in xmlCtxtDumpDocumentHead()
1174 xmlCtxtDumpString(ctxt, doc->encoding); in xmlCtxtDumpDocumentHead()
1175 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1177 if (doc->URL != NULL) { in xmlCtxtDumpDocumentHead()
1178 fprintf(ctxt->output, "URL="); in xmlCtxtDumpDocumentHead()
1179 xmlCtxtDumpString(ctxt, doc->URL); in xmlCtxtDumpDocumentHead()
1180 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1182 if (doc->standalone) in xmlCtxtDumpDocumentHead()
1183 fprintf(ctxt->output, "standalone=true\n"); in xmlCtxtDumpDocumentHead()
1185 if (doc->oldNs != NULL) in xmlCtxtDumpDocumentHead()
1186 xmlCtxtDumpNamespaceList(ctxt, doc->oldNs); in xmlCtxtDumpDocumentHead()
1191 * @output: the FILE * for the output
1200 if (!ctxt->check) in xmlCtxtDumpDocument()
1201 fprintf(ctxt->output, "DOCUMENT == NULL !\n"); in xmlCtxtDumpDocument()
1205 if (((doc->type == XML_DOCUMENT_NODE) || in xmlCtxtDumpDocument()
1206 (doc->type == XML_HTML_DOCUMENT_NODE)) in xmlCtxtDumpDocument()
1207 && (doc->children != NULL)) { in xmlCtxtDumpDocument()
1208 ctxt->depth++; in xmlCtxtDumpDocument()
1209 xmlCtxtDumpNodeList(ctxt, doc->children); in xmlCtxtDumpDocument()
1210 ctxt->depth--; in xmlCtxtDumpDocument()
1221 if (!ctxt->check) in xmlCtxtDumpEntityCallback()
1222 fprintf(ctxt->output, "Entity is NULL"); in xmlCtxtDumpEntityCallback()
1225 if (!ctxt->check) { in xmlCtxtDumpEntityCallback()
1226 fprintf(ctxt->output, "%s : ", (char *) cur->name); in xmlCtxtDumpEntityCallback()
1227 switch (cur->etype) { in xmlCtxtDumpEntityCallback()
1229 fprintf(ctxt->output, "INTERNAL GENERAL, "); in xmlCtxtDumpEntityCallback()
1232 fprintf(ctxt->output, "EXTERNAL PARSED, "); in xmlCtxtDumpEntityCallback()
1235 fprintf(ctxt->output, "EXTERNAL UNPARSED, "); in xmlCtxtDumpEntityCallback()
1238 fprintf(ctxt->output, "INTERNAL PARAMETER, "); in xmlCtxtDumpEntityCallback()
1241 fprintf(ctxt->output, "EXTERNAL PARAMETER, "); in xmlCtxtDumpEntityCallback()
1245 "Unknown entity type %d\n", cur->etype); in xmlCtxtDumpEntityCallback()
1247 if (cur->ExternalID != NULL) in xmlCtxtDumpEntityCallback()
1248 fprintf(ctxt->output, "ID \"%s\"", (char *) cur->ExternalID); in xmlCtxtDumpEntityCallback()
1249 if (cur->SystemID != NULL) in xmlCtxtDumpEntityCallback()
1250 fprintf(ctxt->output, "SYSTEM \"%s\"", (char *) cur->SystemID); in xmlCtxtDumpEntityCallback()
1251 if (cur->orig != NULL) in xmlCtxtDumpEntityCallback()
1252 fprintf(ctxt->output, "\n orig \"%s\"", (char *) cur->orig); in xmlCtxtDumpEntityCallback()
1253 if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) in xmlCtxtDumpEntityCallback()
1254 fprintf(ctxt->output, "\n content \"%s\"", in xmlCtxtDumpEntityCallback()
1255 (char *) cur->content); in xmlCtxtDumpEntityCallback()
1256 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntityCallback()
1262 * @output: the FILE * for the output
1272 if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { in xmlCtxtDumpEntities()
1274 doc->intSubset->entities; in xmlCtxtDumpEntities()
1276 if (!ctxt->check) in xmlCtxtDumpEntities()
1277 fprintf(ctxt->output, "Entities in internal subset\n"); in xmlCtxtDumpEntities()
1280 fprintf(ctxt->output, "No entities in internal subset\n"); in xmlCtxtDumpEntities()
1281 if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { in xmlCtxtDumpEntities()
1283 doc->extSubset->entities; in xmlCtxtDumpEntities()
1285 if (!ctxt->check) in xmlCtxtDumpEntities()
1286 fprintf(ctxt->output, "Entities in external subset\n"); in xmlCtxtDumpEntities()
1288 } else if (!ctxt->check) in xmlCtxtDumpEntities()
1289 fprintf(ctxt->output, "No entities in external subset\n"); in xmlCtxtDumpEntities()
1294 * @output: the FILE * for the output
1303 if (!ctxt->check) in xmlCtxtDumpDTD()
1304 fprintf(ctxt->output, "DTD is NULL\n"); in xmlCtxtDumpDTD()
1308 if (dtd->children == NULL) in xmlCtxtDumpDTD()
1309 fprintf(ctxt->output, " DTD is empty\n"); in xmlCtxtDumpDTD()
1311 ctxt->depth++; in xmlCtxtDumpDTD()
1312 xmlCtxtDumpNodeList(ctxt, dtd->children); in xmlCtxtDumpDTD()
1313 ctxt->depth--; in xmlCtxtDumpDTD()
1325 * @output: the FILE * for the output
1331 xmlDebugDumpString(FILE * output, const xmlChar * str) in xmlDebugDumpString() argument
1335 if (output == NULL) in xmlDebugDumpString()
1336 output = stdout; in xmlDebugDumpString()
1338 fprintf(output, "(NULL)"); in xmlDebugDumpString()
1345 fputc(' ', output); in xmlDebugDumpString()
1347 fprintf(output, "#%X", str[i]); in xmlDebugDumpString()
1349 fputc(str[i], output); in xmlDebugDumpString()
1350 fprintf(output, "..."); in xmlDebugDumpString()
1355 * @output: the FILE * for the output
1362 xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) { in xmlDebugDumpAttr() argument
1365 if (output == NULL) return; in xmlDebugDumpAttr()
1367 ctxt.output = output; in xmlDebugDumpAttr()
1376 * @output: the FILE * for the output
1382 xmlDebugDumpEntities(FILE * output, xmlDocPtr doc) in xmlDebugDumpEntities() argument
1386 if (output == NULL) return; in xmlDebugDumpEntities()
1388 ctxt.output = output; in xmlDebugDumpEntities()
1395 * @output: the FILE * for the output
1402 xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth) in xmlDebugDumpAttrList() argument
1406 if (output == NULL) return; in xmlDebugDumpAttrList()
1408 ctxt.output = output; in xmlDebugDumpAttrList()
1416 * @output: the FILE * for the output
1423 xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpOneNode() argument
1427 if (output == NULL) return; in xmlDebugDumpOneNode()
1429 ctxt.output = output; in xmlDebugDumpOneNode()
1437 * @output: the FILE * for the output
1444 xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpNode() argument
1448 if (output == NULL) in xmlDebugDumpNode()
1449 output = stdout; in xmlDebugDumpNode()
1451 ctxt.output = output; in xmlDebugDumpNode()
1459 * @output: the FILE * for the output
1466 xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpNodeList() argument
1470 if (output == NULL) in xmlDebugDumpNodeList()
1471 output = stdout; in xmlDebugDumpNodeList()
1473 ctxt.output = output; in xmlDebugDumpNodeList()
1481 * @output: the FILE * for the output
1487 xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc) in xmlDebugDumpDocumentHead() argument
1491 if (output == NULL) in xmlDebugDumpDocumentHead()
1492 output = stdout; in xmlDebugDumpDocumentHead()
1495 ctxt.output = output; in xmlDebugDumpDocumentHead()
1502 * @output: the FILE * for the output
1508 xmlDebugDumpDocument(FILE * output, xmlDocPtr doc) in xmlDebugDumpDocument() argument
1512 if (output == NULL) in xmlDebugDumpDocument()
1513 output = stdout; in xmlDebugDumpDocument()
1516 ctxt.output = output; in xmlDebugDumpDocument()
1523 * @output: the FILE * for the output
1529 xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd) in xmlDebugDumpDTD() argument
1533 if (output == NULL) in xmlDebugDumpDTD()
1534 output = stdout; in xmlDebugDumpDTD()
1537 ctxt.output = output; in xmlDebugDumpDTD()
1550 * @output: the FILE * for the output
1553 * Check the document for potential content problems, and output
1554 * the errors to @output
1559 xmlDebugCheckDocument(FILE * output, xmlDocPtr doc) in xmlDebugCheckDocument() argument
1563 if (output == NULL) in xmlDebugCheckDocument()
1564 output = stdout; in xmlDebugCheckDocument()
1566 ctxt.output = output; in xmlDebugCheckDocument()
1595 switch (node->type) { in xmlLsCountNode()
1597 list = node->children; in xmlLsCountNode()
1601 list = ((xmlDocPtr) node)->children; in xmlLsCountNode()
1604 list = ((xmlAttrPtr) node)->children; in xmlLsCountNode()
1610 if (node->content != NULL) { in xmlLsCountNode()
1611 ret = xmlStrlen(node->content); in xmlLsCountNode()
1630 list = list->next; in xmlLsCountNode()
1636 * @output: the FILE * for the output
1639 * Dump to @output the type and name of @node.
1642 xmlLsOneNode(FILE *output, xmlNodePtr node) { in xmlLsOneNode() argument
1643 if (output == NULL) return; in xmlLsOneNode()
1645 fprintf(output, "NULL\n"); in xmlLsOneNode()
1648 switch (node->type) { in xmlLsOneNode()
1650 fprintf(output, "-"); in xmlLsOneNode()
1653 fprintf(output, "a"); in xmlLsOneNode()
1656 fprintf(output, "t"); in xmlLsOneNode()
1659 fprintf(output, "C"); in xmlLsOneNode()
1662 fprintf(output, "e"); in xmlLsOneNode()
1665 fprintf(output, "E"); in xmlLsOneNode()
1668 fprintf(output, "p"); in xmlLsOneNode()
1671 fprintf(output, "c"); in xmlLsOneNode()
1674 fprintf(output, "d"); in xmlLsOneNode()
1677 fprintf(output, "h"); in xmlLsOneNode()
1680 fprintf(output, "T"); in xmlLsOneNode()
1683 fprintf(output, "F"); in xmlLsOneNode()
1686 fprintf(output, "N"); in xmlLsOneNode()
1689 fprintf(output, "n"); in xmlLsOneNode()
1692 fprintf(output, "?"); in xmlLsOneNode()
1694 if (node->type != XML_NAMESPACE_DECL) { in xmlLsOneNode()
1695 if (node->properties != NULL) in xmlLsOneNode()
1696 fprintf(output, "a"); in xmlLsOneNode()
1698 fprintf(output, "-"); in xmlLsOneNode()
1699 if (node->nsDef != NULL) in xmlLsOneNode()
1700 fprintf(output, "n"); in xmlLsOneNode()
1702 fprintf(output, "-"); in xmlLsOneNode()
1705 fprintf(output, " %8d ", xmlLsCountNode(node)); in xmlLsOneNode()
1707 switch (node->type) { in xmlLsOneNode()
1709 if (node->name != NULL) { in xmlLsOneNode()
1710 if ((node->ns != NULL) && (node->ns->prefix != NULL)) in xmlLsOneNode()
1711 fprintf(output, "%s:", node->ns->prefix); in xmlLsOneNode()
1712 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1716 if (node->name != NULL) in xmlLsOneNode()
1717 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1720 if (node->content != NULL) { in xmlLsOneNode()
1721 xmlDebugDumpString(output, node->content); in xmlLsOneNode()
1727 if (node->name != NULL) in xmlLsOneNode()
1728 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1731 if (node->name != NULL) in xmlLsOneNode()
1732 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1735 if (node->name != NULL) in xmlLsOneNode()
1736 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1753 if (ns->prefix == NULL) in xmlLsOneNode()
1754 fprintf(output, "default -> %s", (char *)ns->href); in xmlLsOneNode()
1756 fprintf(output, "%s -> %s", (char *)ns->prefix, in xmlLsOneNode()
1757 (char *)ns->href); in xmlLsOneNode()
1761 if (node->name != NULL) in xmlLsOneNode()
1762 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1764 fprintf(output, "\n"); in xmlLsOneNode()
1795 * - allow to shell out an editor on a subpart
1796 * - cleanup function registrations (with help) and calling
1797 * - provide registration routines
1835 "%s is user-defined\n", arg); in xmlShellPrintXPathError()
1853 * @ctxt : a non-null shell context
1854 * @node : a non-null node to print to the output FILE
1856 * Print node to the output FILE
1868 fp = ctxt->output; in xmlShellPrintNodeCtxt()
1870 if (node->type == XML_DOCUMENT_NODE) in xmlShellPrintNodeCtxt()
1872 else if (node->type == XML_ATTRIBUTE_NODE) in xmlShellPrintNodeCtxt()
1875 xmlElemDump(fp, node->doc, node); in xmlShellPrintNodeCtxt()
1882 * @node : a non-null node to print to the output FILE
1884 * Print node to the output FILE
1898 * Prints result to the output FILE
1907 switch (list->type) { in xmlShellPrintXPathResultCtxt()
1912 if (list->nodesetval) { in xmlShellPrintXPathResultCtxt()
1913 for (indx = 0; indx < list->nodesetval->nodeNr; in xmlShellPrintXPathResultCtxt()
1916 list->nodesetval->nodeTab[indx]); in xmlShellPrintXPathResultCtxt()
1919 fprintf(ctxt->output, in xmlShellPrintXPathResultCtxt()
1924 fprintf(ctxt->output, in xmlShellPrintXPathResultCtxt()
1929 fprintf(ctxt->output, in xmlShellPrintXPathResultCtxt()
1931 xmlBoolToText(list->boolval)); in xmlShellPrintXPathResultCtxt()
1934 fprintf(ctxt->output, in xmlShellPrintXPathResultCtxt()
1935 "Is a number:%0g\n", list->floatval); in xmlShellPrintXPathResultCtxt()
1938 fprintf(ctxt->output, in xmlShellPrintXPathResultCtxt()
1939 "Is a string:%s\n", list->stringval); in xmlShellPrintXPathResultCtxt()
1943 xmlShellPrintXPathError(list->type, NULL); in xmlShellPrintXPathResultCtxt()
1952 * Prints result to the output FILE
1981 fprintf(ctxt->output, "NULL\n"); in xmlShellList()
1984 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellList()
1985 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellList()
1986 cur = ((xmlDocPtr) node)->children; in xmlShellList()
1987 } else if (node->type == XML_NAMESPACE_DECL) { in xmlShellList()
1988 xmlLsOneNode(ctxt->output, node); in xmlShellList()
1990 } else if (node->children != NULL) { in xmlShellList()
1991 cur = node->children; in xmlShellList()
1993 xmlLsOneNode(ctxt->output, node); in xmlShellList()
1997 xmlLsOneNode(ctxt->output, cur); in xmlShellList()
1998 cur = cur->next; in xmlShellList()
2024 fprintf(ctxt->output, "NULL\n"); in xmlShellBase()
2028 base = xmlNodeGetBase(node->doc, node); in xmlShellBase()
2031 fprintf(ctxt->output, " No base found !!!\n"); in xmlShellBase()
2033 fprintf(ctxt->output, "%s\n", base); in xmlShellBase()
2096 fprintf(ctxt->output, "setns: prefix=[nsuri] required\n"); in xmlShellRegisterNamespace()
2098 return(-1); in xmlShellRegisterNamespace()
2110 if(xmlXPathRegisterNs(ctxt->pctxt, prefix, href) != 0) { in xmlShellRegisterNamespace()
2111 …fprintf(ctxt->output,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", prefix, … in xmlShellRegisterNamespace()
2113 return(-1); in xmlShellRegisterNamespace()
2138 if ((root == NULL) || (root->type != XML_ELEMENT_NODE) || in xmlShellRegisterRootNamespaces()
2139 (root->nsDef == NULL) || (ctxt == NULL) || (ctxt->pctxt == NULL)) in xmlShellRegisterRootNamespaces()
2140 return(-1); in xmlShellRegisterRootNamespaces()
2141 ns = root->nsDef; in xmlShellRegisterRootNamespaces()
2143 if (ns->prefix == NULL) in xmlShellRegisterRootNamespaces()
2144 xmlXPathRegisterNs(ctxt->pctxt, BAD_CAST "defaultns", ns->href); in xmlShellRegisterRootNamespaces()
2146 xmlXPathRegisterNs(ctxt->pctxt, ns->prefix, ns->href); in xmlShellRegisterRootNamespaces()
2147 ns = ns->next; in xmlShellRegisterRootNamespaces()
2183 if (node->type == XML_COMMENT_NODE) { in xmlShellGrep()
2184 if (xmlStrstr(node->content, (xmlChar *) arg)) { in xmlShellGrep()
2186 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node)); in xmlShellGrep()
2189 } else if (node->type == XML_TEXT_NODE) { in xmlShellGrep()
2190 if (xmlStrstr(node->content, (xmlChar *) arg)) { in xmlShellGrep()
2192 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent)); in xmlShellGrep()
2193 xmlShellList(ctxt, NULL, node->parent, NULL); in xmlShellGrep()
2201 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellGrep()
2202 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellGrep()
2203 node = ((xmlDocPtr) node)->children; in xmlShellGrep()
2204 } else if ((node->children != NULL) in xmlShellGrep()
2205 && (node->type != XML_ENTITY_REF_NODE)) { in xmlShellGrep()
2207 node = node->children; in xmlShellGrep()
2208 } else if (node->next != NULL) { in xmlShellGrep()
2210 node = node->next; in xmlShellGrep()
2212 /* go up to parents->next if needed */ in xmlShellGrep()
2214 if (node->parent != NULL) { in xmlShellGrep()
2215 node = node->parent; in xmlShellGrep()
2217 if (node->next != NULL) { in xmlShellGrep()
2218 node = node->next; in xmlShellGrep()
2221 if (node->parent == NULL) { in xmlShellGrep()
2251 fprintf(ctxt->output, "NULL\n"); in xmlShellDir()
2254 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDir()
2255 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDir()
2256 xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node); in xmlShellDir()
2257 } else if (node->type == XML_ATTRIBUTE_NODE) { in xmlShellDir()
2258 xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0); in xmlShellDir()
2260 xmlDebugDumpOneNode(ctxt->output, node, 0); in xmlShellDir()
2288 fprintf(ctxt->output, "NULL\n"); in xmlShellSetContent()
2292 fprintf(ctxt->output, "NULL\n"); in xmlShellSetContent()
2298 if (node->children != NULL) { in xmlShellSetContent()
2299 xmlFreeNodeList(node->children); in xmlShellSetContent()
2300 node->children = NULL; in xmlShellSetContent()
2301 node->last = NULL; in xmlShellSetContent()
2305 fprintf(ctxt->output, "failed to parse content\n"); in xmlShellSetContent()
2316 vfprintf(sctxt->output, msg, ap); in xmlShellPrintf()
2324 * @schemas: the path to the Relax-NG schemas
2329 * validating the instance against a Relax-NG schemas
2348 fprintf(sctxt->output, in xmlShellRNGValidate()
2349 "Relax-NG schema %s failed to compile\n", schemas); in xmlShellRNGValidate()
2350 return(-1); in xmlShellRNGValidate()
2354 ret = xmlRelaxNGValidateDoc(vctxt, sctxt->doc); in xmlShellRNGValidate()
2356 fprintf(sctxt->output, "%s validates\n", sctxt->filename); in xmlShellRNGValidate()
2358 fprintf(sctxt->output, "%s fails to validate\n", sctxt->filename); in xmlShellRNGValidate()
2360 fprintf(sctxt->output, "%s validation generated an internal error\n", in xmlShellRNGValidate()
2361 sctxt->filename); in xmlShellRNGValidate()
2390 fprintf(ctxt->output, "NULL\n"); in xmlShellCat()
2393 if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) { in xmlShellCat()
2395 if (node->type == XML_HTML_DOCUMENT_NODE) in xmlShellCat()
2396 htmlDocDump(ctxt->output, (htmlDocPtr) node); in xmlShellCat()
2398 htmlNodeDumpFile(ctxt->output, ctxt->doc, node); in xmlShellCat()
2400 if (node->type == XML_DOCUMENT_NODE) in xmlShellCat()
2401 xmlDocDump(ctxt->output, (xmlDocPtr) node); in xmlShellCat()
2403 xmlElemDump(ctxt->output, ctxt->doc, node); in xmlShellCat()
2406 if (node->type == XML_DOCUMENT_NODE) in xmlShellCat()
2407 xmlDocDump(ctxt->output, (xmlDocPtr) node); in xmlShellCat()
2409 xmlElemDump(ctxt->output, ctxt->doc, node); in xmlShellCat()
2411 fprintf(ctxt->output, "\n"); in xmlShellCat()
2426 * Returns 0 or -1 if loading failed
2436 if ((ctxt == NULL) || (filename == NULL)) return(-1); in xmlShellLoad()
2437 if (ctxt->doc != NULL) in xmlShellLoad()
2438 html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE); in xmlShellLoad()
2444 fprintf(ctxt->output, "HTML support not compiled in\n"); in xmlShellLoad()
2451 if (ctxt->loaded == 1) { in xmlShellLoad()
2452 xmlFreeDoc(ctxt->doc); in xmlShellLoad()
2454 ctxt->loaded = 1; in xmlShellLoad()
2456 xmlXPathFreeContext(ctxt->pctxt); in xmlShellLoad()
2458 xmlFree(ctxt->filename); in xmlShellLoad()
2459 ctxt->doc = doc; in xmlShellLoad()
2460 ctxt->node = (xmlNodePtr) doc; in xmlShellLoad()
2462 ctxt->pctxt = xmlXPathNewContext(doc); in xmlShellLoad()
2464 ctxt->filename = (char *) xmlCanonicPath((xmlChar *) filename); in xmlShellLoad()
2466 return (-1); in xmlShellLoad()
2482 * Returns 0 or -1 in case of error
2489 return (-1); in xmlShellWrite()
2491 return (-1); in xmlShellWrite()
2495 fprintf(ctxt->output, in xmlShellWrite()
2497 return (-1); in xmlShellWrite()
2500 switch (node->type) { in xmlShellWrite()
2502 if (xmlSaveFile((char *) filename, ctxt->doc) < -1) { in xmlShellWrite()
2503 fprintf(ctxt->output, in xmlShellWrite()
2505 return (-1); in xmlShellWrite()
2510 if (htmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellWrite()
2511 fprintf(ctxt->output, in xmlShellWrite()
2513 return (-1); in xmlShellWrite()
2516 if (xmlSaveFile((char *) filename, ctxt->doc) < -1) { in xmlShellWrite()
2517 fprintf(ctxt->output, in xmlShellWrite()
2519 return (-1); in xmlShellWrite()
2528 fprintf(ctxt->output, in xmlShellWrite()
2530 return (-1); in xmlShellWrite()
2532 xmlElemDump(f, ctxt->doc, node); in xmlShellWrite()
2549 * Returns 0 or -1 in case of error
2556 if ((ctxt == NULL) || (ctxt->doc == NULL)) in xmlShellSave()
2557 return (-1); in xmlShellSave()
2559 filename = ctxt->filename; in xmlShellSave()
2561 return (-1); in xmlShellSave()
2564 fprintf(ctxt->output, in xmlShellSave()
2566 return (-1); in xmlShellSave()
2569 switch (ctxt->doc->type) { in xmlShellSave()
2571 if (xmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2572 fprintf(ctxt->output, in xmlShellSave()
2578 if (htmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2579 fprintf(ctxt->output, in xmlShellSave()
2583 if (xmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2584 fprintf(ctxt->output, in xmlShellSave()
2590 fprintf(ctxt->output, in xmlShellSave()
2592 return (-1); in xmlShellSave()
2611 * Returns 0 or -1 in case of error
2619 int res = -1; in xmlShellValidate()
2621 if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1); in xmlShellValidate()
2628 res = xmlValidateDocument(&vctxt, ctxt->doc); in xmlShellValidate()
2634 res = xmlValidateDtd(&vctxt, ctxt->doc, subset); in xmlShellValidate()
2654 * Returns 0 or -1 in case of error
2665 return (-1); in xmlShellDu()
2668 return (-1); in xmlShellDu()
2671 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDu()
2672 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDu()
2673 fprintf(ctxt->output, "/\n"); in xmlShellDu()
2674 } else if (node->type == XML_ELEMENT_NODE) { in xmlShellDu()
2676 fprintf(ctxt->output, " "); in xmlShellDu()
2677 if ((node->ns) && (node->ns->prefix)) in xmlShellDu()
2678 fprintf(ctxt->output, "%s:", node->ns->prefix); in xmlShellDu()
2679 fprintf(ctxt->output, "%s\n", node->name); in xmlShellDu()
2687 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDu()
2688 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDu()
2689 node = ((xmlDocPtr) node)->children; in xmlShellDu()
2690 } else if ((node->children != NULL) in xmlShellDu()
2691 && (node->type != XML_ENTITY_REF_NODE)) { in xmlShellDu()
2693 node = node->children; in xmlShellDu()
2695 } else if ((node != tree) && (node->next != NULL)) { in xmlShellDu()
2697 node = node->next; in xmlShellDu()
2699 /* go up to parents->next if needed */ in xmlShellDu()
2701 if (node->parent != NULL) { in xmlShellDu()
2702 node = node->parent; in xmlShellDu()
2703 indent--; in xmlShellDu()
2705 if ((node != tree) && (node->next != NULL)) { in xmlShellDu()
2706 node = node->next; in xmlShellDu()
2709 if (node->parent == NULL) { in xmlShellDu()
2730 * @buffer: the output buffer
2737 * The output is compatible with XPath commands.
2739 * Returns 0 or -1 in case of error
2748 return (-1); in xmlShellPwd()
2752 return (-1); in xmlShellPwd()
2772 * @filename: the output buffer
2774 * @output: the output FILE*, defaults to stdout if NULL
2782 FILE * output) in xmlShell() argument
2798 if (output == NULL) in xmlShell()
2799 output = stdout; in xmlShell()
2803 ctxt->loaded = 0; in xmlShell()
2804 ctxt->doc = doc; in xmlShell()
2805 ctxt->input = input; in xmlShell()
2806 ctxt->output = output; in xmlShell()
2807 ctxt->filename = (char *) xmlStrdup((xmlChar *) filename); in xmlShell()
2808 ctxt->node = (xmlNodePtr) ctxt->doc; in xmlShell()
2811 ctxt->pctxt = xmlXPathNewContext(ctxt->doc); in xmlShell()
2812 if (ctxt->pctxt == NULL) { in xmlShell()
2818 if (ctxt->node == (xmlNodePtr) ctxt->doc) in xmlShell()
2820 else if ((ctxt->node != NULL) && (ctxt->node->name) && in xmlShell()
2821 (ctxt->node->ns) && (ctxt->node->ns->prefix)) in xmlShell()
2823 (ctxt->node->ns->prefix), ctxt->node->name); in xmlShell()
2824 else if ((ctxt->node != NULL) && (ctxt->node->name)) in xmlShell()
2825 snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name); in xmlShell()
2828 prompt[sizeof(prompt) - 1] = 0; in xmlShell()
2833 cmdline = ctxt->input(prompt); in xmlShell()
2877 fprintf(ctxt->output, "\tbase display XML base of the node\n"); in xmlShell()
2878 fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n"); in xmlShell()
2879 fprintf(ctxt->output, "\tbye leave shell\n"); in xmlShell()
2880 fprintf(ctxt->output, "\tcat [node] display node or current node\n"); in xmlShell()
2881 fprintf(ctxt->output, "\tcd [path] change directory to path or to root\n"); in xmlShell()
2882 …fprintf(ctxt->output, "\tdir [path] dumps information about the node (namespace, attributes, con… in xmlShell()
2883 …fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current … in xmlShell()
2884 fprintf(ctxt->output, "\texit leave shell\n"); in xmlShell()
2885 fprintf(ctxt->output, "\thelp display this help\n"); in xmlShell()
2886 fprintf(ctxt->output, "\tfree display memory usage\n"); in xmlShell()
2887 fprintf(ctxt->output, "\tload [name] load a new document with name\n"); in xmlShell()
2888 fprintf(ctxt->output, "\tls [path] list contents of path or the current directory\n"); in xmlShell()
2889 …fprintf(ctxt->output, "\tset xml_fragment replace the current node content with the fragment parse… in xmlShell()
2891 …fprintf(ctxt->output, "\txpath expr evaluate the XPath expression in that context and print the … in xmlShell()
2892 …fprintf(ctxt->output, "\tsetns nsreg register a namespace to a prefix in the XPath evaluation con… in xmlShell()
2893 …fprintf(ctxt->output, "\t format for nsreg is: prefix=[nsuri] (i.e. prefix= unsets a p… in xmlShell()
2894 fprintf(ctxt->output, "\tsetrootns register all namespace found on the root element\n"); in xmlShell()
2895 fprintf(ctxt->output, "\t the default namespace if any uses 'defaultns' prefix\n"); in xmlShell()
2897 fprintf(ctxt->output, "\tpwd display current working directory\n"); in xmlShell()
2898 …fprintf(ctxt->output, "\twhereis display absolute path of [path] or current working directory… in xmlShell()
2899 fprintf(ctxt->output, "\tquit leave shell\n"); in xmlShell()
2901 fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n"); in xmlShell()
2902 fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n"); in xmlShell()
2905 fprintf(ctxt->output, "\tvalidate check the document for errors\n"); in xmlShell()
2908 fprintf(ctxt->output, "\trelaxng rng validate the document against the Relax-NG schemas\n"); in xmlShell()
2910 fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n"); in xmlShell()
2926 fprintf(ctxt->output, in xmlShell()
2929 xmlShellWrite(ctxt, arg, ctxt->node, NULL); in xmlShell()
2932 xmlShellGrep(ctxt, arg, ctxt->node, NULL); in xmlShell()
2936 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) in xmlShell()
2937 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
2940 xmlShellDu(ctxt, NULL, ctxt->node, NULL); in xmlShell()
2942 ctxt->pctxt->node = ctxt->node; in xmlShell()
2944 ctxt->pctxt->node = ctxt->node; in xmlShell()
2945 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
2950 switch (list->type) { in xmlShell()
2952 fprintf(ctxt->output, in xmlShell()
2958 if (list->nodesetval == NULL) in xmlShell()
2962 indx < list->nodesetval->nodeNr; in xmlShell()
2965 list->nodesetval-> in xmlShell()
2970 fprintf(ctxt->output, in xmlShell()
2974 fprintf(ctxt->output, in xmlShell()
2978 fprintf(ctxt->output, in xmlShell()
2982 fprintf(ctxt->output, in xmlShell()
2983 "%s is user-defined\n", arg); in xmlShell()
2986 fprintf(ctxt->output, in xmlShell()
2995 fprintf(ctxt->output, in xmlShell()
2998 ctxt->pctxt->node = NULL; in xmlShell()
3001 xmlShellBase(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3003 xmlShellSetContent(ctxt, arg, ctxt->node, NULL); in xmlShell()
3007 fprintf(ctxt->output, in xmlShell()
3015 root = xmlDocGetRootElement(ctxt->doc); in xmlShell()
3019 fprintf(ctxt->output, in xmlShell()
3022 ctxt->pctxt->node = ctxt->node; in xmlShell()
3023 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3024 xmlXPathDebugDumpObject(ctxt->output, list, 0); in xmlShell()
3030 xmlShellSetBase(ctxt, arg, ctxt->node, NULL); in xmlShell()
3037 xmlShellDir(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3039 xmlShellList(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3041 ctxt->pctxt->node = ctxt->node; in xmlShell()
3043 ctxt->pctxt->node = ctxt->node; in xmlShell()
3044 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3049 switch (list->type) { in xmlShell()
3051 fprintf(ctxt->output, in xmlShell()
3057 if (list->nodesetval == NULL) in xmlShell()
3061 indx < list->nodesetval->nodeNr; in xmlShell()
3065 list->nodesetval-> in xmlShell()
3069 list->nodesetval-> in xmlShell()
3075 fprintf(ctxt->output, in xmlShell()
3079 fprintf(ctxt->output, in xmlShell()
3083 fprintf(ctxt->output, in xmlShell()
3087 fprintf(ctxt->output, in xmlShell()
3088 "%s is user-defined\n", arg); in xmlShell()
3091 fprintf(ctxt->output, in xmlShell()
3100 fprintf(ctxt->output, in xmlShell()
3103 ctxt->pctxt->node = NULL; in xmlShell()
3109 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) in xmlShell()
3110 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
3112 ctxt->pctxt->node = ctxt->node; in xmlShell()
3114 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3119 switch (list->type) { in xmlShell()
3121 fprintf(ctxt->output, in xmlShell()
3127 if (list->nodesetval == NULL) in xmlShell()
3131 indx < list->nodesetval->nodeNr; in xmlShell()
3133 if (!xmlShellPwd(ctxt, dir, list->nodesetval-> in xmlShell()
3135 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
3140 fprintf(ctxt->output, in xmlShell()
3144 fprintf(ctxt->output, in xmlShell()
3148 fprintf(ctxt->output, in xmlShell()
3152 fprintf(ctxt->output, in xmlShell()
3153 "%s is user-defined\n", arg); in xmlShell()
3156 fprintf(ctxt->output, in xmlShell()
3165 fprintf(ctxt->output, in xmlShell()
3168 ctxt->pctxt->node = NULL; in xmlShell()
3172 ctxt->node = (xmlNodePtr) ctxt->doc; in xmlShell()
3177 ctxt->pctxt->node = ctxt->node; in xmlShell()
3179 if ((l >= 2) && (arg[l - 1] == '/')) in xmlShell()
3180 arg[l - 1] = 0; in xmlShell()
3181 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3186 switch (list->type) { in xmlShell()
3188 fprintf(ctxt->output, in xmlShell()
3192 if (list->nodesetval != NULL) { in xmlShell()
3193 if (list->nodesetval->nodeNr == 1) { in xmlShell()
3194 ctxt->node = list->nodesetval->nodeTab[0]; in xmlShell()
3195 if ((ctxt->node != NULL) && in xmlShell()
3196 (ctxt->node->type == in xmlShell()
3198 fprintf(ctxt->output, in xmlShell()
3200 ctxt->node = NULL; in xmlShell()
3203 fprintf(ctxt->output, in xmlShell()
3206 list->nodesetval->nodeNr); in xmlShell()
3208 fprintf(ctxt->output, in xmlShell()
3213 fprintf(ctxt->output, in xmlShell()
3217 fprintf(ctxt->output, in xmlShell()
3221 fprintf(ctxt->output, in xmlShell()
3225 fprintf(ctxt->output, in xmlShell()
3226 "%s is user-defined\n", arg); in xmlShell()
3229 fprintf(ctxt->output, in xmlShell()
3238 fprintf(ctxt->output, in xmlShell()
3241 ctxt->pctxt->node = NULL; in xmlShell()
3246 xmlShellCat(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3248 ctxt->pctxt->node = ctxt->node; in xmlShell()
3250 ctxt->pctxt->node = ctxt->node; in xmlShell()
3251 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3256 switch (list->type) { in xmlShell()
3258 fprintf(ctxt->output, in xmlShell()
3264 if (list->nodesetval == NULL) in xmlShell()
3268 indx < list->nodesetval->nodeNr; in xmlShell()
3271 fprintf(ctxt->output, " -------\n"); in xmlShell()
3273 list->nodesetval-> in xmlShell()
3279 fprintf(ctxt->output, in xmlShell()
3283 fprintf(ctxt->output, in xmlShell()
3287 fprintf(ctxt->output, in xmlShell()
3291 fprintf(ctxt->output, in xmlShell()
3292 "%s is user-defined\n", arg); in xmlShell()
3295 fprintf(ctxt->output, in xmlShell()
3304 fprintf(ctxt->output, in xmlShell()
3307 ctxt->pctxt->node = NULL; in xmlShell()
3311 fprintf(ctxt->output, in xmlShell()
3318 xmlXPathFreeContext(ctxt->pctxt); in xmlShell()
3320 if (ctxt->loaded) { in xmlShell()
3321 xmlFreeDoc(ctxt->doc); in xmlShell()
3323 if (ctxt->filename != NULL) in xmlShell()
3324 xmlFree(ctxt->filename); in xmlShell()