• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:output +full:- +full:document

40     FILE *output;               /* the output file */  member
43 xmlDocPtr doc; /* current document */
48 int nodict; /* if the document has no dictionary */
59 ctxt->depth = 0; in xmlCtxtDumpInitCtxt()
60 ctxt->check = 0; in xmlCtxtDumpInitCtxt()
61 ctxt->errors = 0; in xmlCtxtDumpInitCtxt()
62 ctxt->output = stdout; in xmlCtxtDumpInitCtxt()
63 ctxt->doc = NULL; in xmlCtxtDumpInitCtxt()
64 ctxt->node = NULL; in xmlCtxtDumpInitCtxt()
65 ctxt->dict = NULL; in xmlCtxtDumpInitCtxt()
66 ctxt->nodict = 0; in xmlCtxtDumpInitCtxt()
67 ctxt->options = 0; in xmlCtxtDumpInitCtxt()
69 ctxt->shift[i] = ' '; in xmlCtxtDumpInitCtxt()
70 ctxt->shift[100] = 0; in xmlCtxtDumpInitCtxt()
86 * Returns 1 if in scope, -1 in case of argument error,
87 * -2 if the namespace is not in scope, and -3 if not on
96 return(-1); in xmlNsCheckScope()
98 if ((node->type != XML_ELEMENT_NODE) && in xmlNsCheckScope()
99 (node->type != XML_ATTRIBUTE_NODE) && in xmlNsCheckScope()
100 (node->type != XML_DOCUMENT_NODE) && in xmlNsCheckScope()
101 (node->type != XML_TEXT_NODE) && in xmlNsCheckScope()
102 (node->type != XML_HTML_DOCUMENT_NODE) && in xmlNsCheckScope()
103 (node->type != XML_XINCLUDE_START)) in xmlNsCheckScope()
104 return(-2); in xmlNsCheckScope()
107 ((node->type == XML_ELEMENT_NODE) || in xmlNsCheckScope()
108 (node->type == XML_ATTRIBUTE_NODE) || in xmlNsCheckScope()
109 (node->type == XML_TEXT_NODE) || in xmlNsCheckScope()
110 (node->type == XML_XINCLUDE_START))) { in xmlNsCheckScope()
111 if ((node->type == XML_ELEMENT_NODE) || in xmlNsCheckScope()
112 (node->type == XML_XINCLUDE_START)) { in xmlNsCheckScope()
113 cur = node->nsDef; in xmlNsCheckScope()
117 if (xmlStrEqual(cur->prefix, ns->prefix)) in xmlNsCheckScope()
118 return(-2); in xmlNsCheckScope()
119 cur = cur->next; in xmlNsCheckScope()
122 node = node->parent; in xmlNsCheckScope()
124 /* the xml namespace may be declared on the document node */ in xmlNsCheckScope()
126 ((node->type == XML_DOCUMENT_NODE) || in xmlNsCheckScope()
127 (node->type == XML_HTML_DOCUMENT_NODE))) { in xmlNsCheckScope()
128 xmlNsPtr oldNs = ((xmlDocPtr) node)->oldNs; in xmlNsCheckScope()
132 return(-3); in xmlNsCheckScope()
138 if (ctxt->check) in xmlCtxtDumpSpaces()
140 if ((ctxt->output != NULL) && (ctxt->depth > 0)) { in xmlCtxtDumpSpaces()
141 if (ctxt->depth < 50) in xmlCtxtDumpSpaces()
142 fprintf(ctxt->output, "%s", &ctxt->shift[100 - 2 * ctxt->depth]); in xmlCtxtDumpSpaces()
144 fprintf(ctxt->output, "%s", ctxt->shift); in xmlCtxtDumpSpaces()
158 ctxt->errors++; in xmlDebugErr()
160 NULL, ctxt->node, XML_FROM_CHECK, in xmlDebugErr()
168 ctxt->errors++; in xmlDebugErr2()
170 NULL, ctxt->node, XML_FROM_CHECK, in xmlDebugErr2()
178 ctxt->errors++; in xmlDebugErr3()
180 NULL, ctxt->node, XML_FROM_CHECK, in xmlDebugErr3()
200 if (ret == -2) { in xmlCtxtNsCheckScope()
201 if (ns->prefix == NULL) in xmlCtxtNsCheckScope()
207 (char *) ns->prefix); in xmlCtxtNsCheckScope()
209 if (ret == -3) { in xmlCtxtNsCheckScope()
210 if (ns->prefix == NULL) in xmlCtxtNsCheckScope()
216 (char *) ns->prefix); in xmlCtxtNsCheckScope()
225 * Do debugging on the string, currently it just checks the UTF-8 content
231 if (ctxt->check) { in xmlCtxtCheckString()
234 "String is not UTF-8 %s", (const char *) str); in xmlCtxtCheckString()
250 if (ctxt->check) { in xmlCtxtCheckName()
261 if ((ctxt->dict != NULL) && in xmlCtxtCheckName()
262 (!xmlDictOwns(ctxt->dict, name)) && in xmlCtxtCheckName()
263 ((ctxt->doc == NULL) || in xmlCtxtCheckName()
264 ((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0))) { in xmlCtxtCheckName()
266 "Name is not from the document dictionary '%s'", in xmlCtxtCheckName()
277 doc = node->doc; in xmlCtxtGenericNodeCheck()
279 if (node->parent == NULL) in xmlCtxtGenericNodeCheck()
282 if (node->doc == NULL) { in xmlCtxtGenericNodeCheck()
287 dict = doc->dict; in xmlCtxtGenericNodeCheck()
288 if ((dict == NULL) && (ctxt->nodict == 0)) { in xmlCtxtGenericNodeCheck()
291 if (doc->type == XML_DOCUMENT_NODE) in xmlCtxtGenericNodeCheck()
293 "Document has no dictionary\n"); in xmlCtxtGenericNodeCheck()
295 ctxt->nodict = 1; in xmlCtxtGenericNodeCheck()
297 if (ctxt->doc == NULL) in xmlCtxtGenericNodeCheck()
298 ctxt->doc = doc; in xmlCtxtGenericNodeCheck()
300 if (ctxt->dict == NULL) { in xmlCtxtGenericNodeCheck()
301 ctxt->dict = dict; in xmlCtxtGenericNodeCheck()
304 if ((node->parent != NULL) && (node->doc != node->parent->doc) && in xmlCtxtGenericNodeCheck()
305 (!xmlStrEqual(node->name, BAD_CAST "pseudoroot"))) in xmlCtxtGenericNodeCheck()
308 if (node->prev == NULL) { in xmlCtxtGenericNodeCheck()
309 if (node->type == XML_ATTRIBUTE_NODE) { in xmlCtxtGenericNodeCheck()
310 if ((node->parent != NULL) && in xmlCtxtGenericNodeCheck()
311 (node != (xmlNodePtr) node->parent->properties)) in xmlCtxtGenericNodeCheck()
315 } else if ((node->parent != NULL) && (node->parent->children != node)) in xmlCtxtGenericNodeCheck()
319 if (node->prev->next != node) in xmlCtxtGenericNodeCheck()
321 "Node prev->next : back link wrong\n"); in xmlCtxtGenericNodeCheck()
323 if (node->next == NULL) { in xmlCtxtGenericNodeCheck()
324 if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) && in xmlCtxtGenericNodeCheck()
325 (node->parent->last != node) && in xmlCtxtGenericNodeCheck()
326 (node->parent->type == XML_ELEMENT_NODE)) in xmlCtxtGenericNodeCheck()
330 if (node->next->prev != node) in xmlCtxtGenericNodeCheck()
332 "Node next->prev : forward link wrong\n"); in xmlCtxtGenericNodeCheck()
333 if (node->next->parent != node->parent) in xmlCtxtGenericNodeCheck()
335 "Node next->prev : forward link wrong\n"); in xmlCtxtGenericNodeCheck()
337 if (node->type == XML_ELEMENT_NODE) { in xmlCtxtGenericNodeCheck()
340 ns = node->nsDef; in xmlCtxtGenericNodeCheck()
343 ns = ns->next; in xmlCtxtGenericNodeCheck()
345 if (node->ns != NULL) in xmlCtxtGenericNodeCheck()
346 xmlCtxtNsCheckScope(ctxt, node, node->ns); in xmlCtxtGenericNodeCheck()
347 } else if (node->type == XML_ATTRIBUTE_NODE) { in xmlCtxtGenericNodeCheck()
348 if (node->ns != NULL) in xmlCtxtGenericNodeCheck()
349 xmlCtxtNsCheckScope(ctxt, node, node->ns); in xmlCtxtGenericNodeCheck()
352 if ((node->type != XML_ELEMENT_NODE) && in xmlCtxtGenericNodeCheck()
353 (node->type != XML_ATTRIBUTE_NODE) && in xmlCtxtGenericNodeCheck()
354 (node->type != XML_ELEMENT_DECL) && in xmlCtxtGenericNodeCheck()
355 (node->type != XML_ATTRIBUTE_DECL) && in xmlCtxtGenericNodeCheck()
356 (node->type != XML_DTD_NODE) && in xmlCtxtGenericNodeCheck()
357 (node->type != XML_HTML_DOCUMENT_NODE) && in xmlCtxtGenericNodeCheck()
358 (node->type != XML_DOCUMENT_NODE)) { in xmlCtxtGenericNodeCheck()
359 if (node->content != NULL) in xmlCtxtGenericNodeCheck()
360 xmlCtxtCheckString(ctxt, (const xmlChar *) node->content); in xmlCtxtGenericNodeCheck()
362 switch (node->type) { in xmlCtxtGenericNodeCheck()
365 xmlCtxtCheckName(ctxt, node->name); in xmlCtxtGenericNodeCheck()
368 if ((node->name == xmlStringText) || in xmlCtxtGenericNodeCheck()
369 (node->name == xmlStringTextNoenc)) in xmlCtxtGenericNodeCheck()
372 if ((ctxt->dict != NULL) && in xmlCtxtGenericNodeCheck()
373 (node->name == xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", in xmlCtxtGenericNodeCheck()
379 (const char *) node->name); in xmlCtxtGenericNodeCheck()
382 if (node->name == xmlStringComment) in xmlCtxtGenericNodeCheck()
386 (const char *) node->name); in xmlCtxtGenericNodeCheck()
389 xmlCtxtCheckName(ctxt, node->name); in xmlCtxtGenericNodeCheck()
392 if (node->name == NULL) in xmlCtxtGenericNodeCheck()
396 (const char *) node->name); in xmlCtxtGenericNodeCheck()
421 if (ctxt->check) { in xmlCtxtDumpString()
426 fprintf(ctxt->output, "(NULL)"); in xmlCtxtDumpString()
433 fputc(' ', ctxt->output); in xmlCtxtDumpString()
435 fprintf(ctxt->output, "#%X", str[i]); in xmlCtxtDumpString()
437 fputc(str[i], ctxt->output); in xmlCtxtDumpString()
438 fprintf(ctxt->output, "..."); in xmlCtxtDumpString()
447 if (!ctxt->check) in xmlCtxtDumpDtdNode()
448 fprintf(ctxt->output, "DTD node is NULL\n"); in xmlCtxtDumpDtdNode()
452 if (dtd->type != XML_DTD_NODE) { in xmlCtxtDumpDtdNode()
457 if (!ctxt->check) { in xmlCtxtDumpDtdNode()
458 if (dtd->name != NULL) in xmlCtxtDumpDtdNode()
459 fprintf(ctxt->output, "DTD(%s)", (char *) dtd->name); in xmlCtxtDumpDtdNode()
461 fprintf(ctxt->output, "DTD"); in xmlCtxtDumpDtdNode()
462 if (dtd->ExternalID != NULL) in xmlCtxtDumpDtdNode()
463 fprintf(ctxt->output, ", PUBLIC %s", (char *) dtd->ExternalID); in xmlCtxtDumpDtdNode()
464 if (dtd->SystemID != NULL) in xmlCtxtDumpDtdNode()
465 fprintf(ctxt->output, ", SYSTEM %s", (char *) dtd->SystemID); in xmlCtxtDumpDtdNode()
466 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDtdNode()
480 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
481 fprintf(ctxt->output, "Attribute declaration is NULL\n"); in xmlCtxtDumpAttrDecl()
484 if (attr->type != XML_ATTRIBUTE_DECL) { in xmlCtxtDumpAttrDecl()
489 if (attr->name != NULL) { in xmlCtxtDumpAttrDecl()
490 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
491 fprintf(ctxt->output, "ATTRDECL(%s)", (char *) attr->name); in xmlCtxtDumpAttrDecl()
495 if (attr->elem != NULL) { in xmlCtxtDumpAttrDecl()
496 if (!ctxt->check) in xmlCtxtDumpAttrDecl()
497 fprintf(ctxt->output, " for %s", (char *) attr->elem); in xmlCtxtDumpAttrDecl()
501 if (!ctxt->check) { in xmlCtxtDumpAttrDecl()
502 switch (attr->atype) { in xmlCtxtDumpAttrDecl()
504 fprintf(ctxt->output, " CDATA"); in xmlCtxtDumpAttrDecl()
507 fprintf(ctxt->output, " ID"); in xmlCtxtDumpAttrDecl()
510 fprintf(ctxt->output, " IDREF"); in xmlCtxtDumpAttrDecl()
513 fprintf(ctxt->output, " IDREFS"); in xmlCtxtDumpAttrDecl()
516 fprintf(ctxt->output, " ENTITY"); in xmlCtxtDumpAttrDecl()
519 fprintf(ctxt->output, " ENTITIES"); in xmlCtxtDumpAttrDecl()
522 fprintf(ctxt->output, " NMTOKEN"); in xmlCtxtDumpAttrDecl()
525 fprintf(ctxt->output, " NMTOKENS"); in xmlCtxtDumpAttrDecl()
528 fprintf(ctxt->output, " ENUMERATION"); in xmlCtxtDumpAttrDecl()
531 fprintf(ctxt->output, " NOTATION "); in xmlCtxtDumpAttrDecl()
534 if (attr->tree != NULL) { in xmlCtxtDumpAttrDecl()
536 xmlEnumerationPtr cur = attr->tree; in xmlCtxtDumpAttrDecl()
540 fprintf(ctxt->output, "|%s", (char *) cur->name); in xmlCtxtDumpAttrDecl()
542 fprintf(ctxt->output, " (%s", (char *) cur->name); in xmlCtxtDumpAttrDecl()
543 cur = cur->next; in xmlCtxtDumpAttrDecl()
548 fprintf(ctxt->output, ")"); in xmlCtxtDumpAttrDecl()
550 fprintf(ctxt->output, "...)"); in xmlCtxtDumpAttrDecl()
552 switch (attr->def) { in xmlCtxtDumpAttrDecl()
556 fprintf(ctxt->output, " REQUIRED"); in xmlCtxtDumpAttrDecl()
559 fprintf(ctxt->output, " IMPLIED"); in xmlCtxtDumpAttrDecl()
562 fprintf(ctxt->output, " FIXED"); in xmlCtxtDumpAttrDecl()
565 if (attr->defaultValue != NULL) { in xmlCtxtDumpAttrDecl()
566 fprintf(ctxt->output, "\""); in xmlCtxtDumpAttrDecl()
567 xmlCtxtDumpString(ctxt, attr->defaultValue); in xmlCtxtDumpAttrDecl()
568 fprintf(ctxt->output, "\""); in xmlCtxtDumpAttrDecl()
570 fprintf(ctxt->output, "\n"); in xmlCtxtDumpAttrDecl()
585 if (!ctxt->check) in xmlCtxtDumpElemDecl()
586 fprintf(ctxt->output, "Element declaration is NULL\n"); in xmlCtxtDumpElemDecl()
589 if (elem->type != XML_ELEMENT_DECL) { in xmlCtxtDumpElemDecl()
594 if (elem->name != NULL) { in xmlCtxtDumpElemDecl()
595 if (!ctxt->check) { in xmlCtxtDumpElemDecl()
596 fprintf(ctxt->output, "ELEMDECL("); in xmlCtxtDumpElemDecl()
597 xmlCtxtDumpString(ctxt, elem->name); in xmlCtxtDumpElemDecl()
598 fprintf(ctxt->output, ")"); in xmlCtxtDumpElemDecl()
603 if (!ctxt->check) { in xmlCtxtDumpElemDecl()
604 switch (elem->etype) { in xmlCtxtDumpElemDecl()
606 fprintf(ctxt->output, ", UNDEFINED"); in xmlCtxtDumpElemDecl()
609 fprintf(ctxt->output, ", EMPTY"); in xmlCtxtDumpElemDecl()
612 fprintf(ctxt->output, ", ANY"); in xmlCtxtDumpElemDecl()
615 fprintf(ctxt->output, ", MIXED "); in xmlCtxtDumpElemDecl()
618 fprintf(ctxt->output, ", MIXED "); in xmlCtxtDumpElemDecl()
621 if ((elem->type != XML_ELEMENT_NODE) && (elem->content != NULL)) { in xmlCtxtDumpElemDecl()
625 xmlSnprintfElementContent(buf, 5000, elem->content, 1); in xmlCtxtDumpElemDecl()
627 fprintf(ctxt->output, "%s", buf); in xmlCtxtDumpElemDecl()
629 fprintf(ctxt->output, "\n"); in xmlCtxtDumpElemDecl()
644 if (!ctxt->check) in xmlCtxtDumpEntityDecl()
645 fprintf(ctxt->output, "Entity declaration is NULL\n"); in xmlCtxtDumpEntityDecl()
648 if (ent->type != XML_ENTITY_DECL) { in xmlCtxtDumpEntityDecl()
653 if (ent->name != NULL) { in xmlCtxtDumpEntityDecl()
654 if (!ctxt->check) { in xmlCtxtDumpEntityDecl()
655 fprintf(ctxt->output, "ENTITYDECL("); in xmlCtxtDumpEntityDecl()
656 xmlCtxtDumpString(ctxt, ent->name); in xmlCtxtDumpEntityDecl()
657 fprintf(ctxt->output, ")"); in xmlCtxtDumpEntityDecl()
662 if (!ctxt->check) { in xmlCtxtDumpEntityDecl()
663 switch (ent->etype) { in xmlCtxtDumpEntityDecl()
665 fprintf(ctxt->output, ", internal\n"); in xmlCtxtDumpEntityDecl()
668 fprintf(ctxt->output, ", external parsed\n"); in xmlCtxtDumpEntityDecl()
671 fprintf(ctxt->output, ", unparsed\n"); in xmlCtxtDumpEntityDecl()
674 fprintf(ctxt->output, ", parameter\n"); in xmlCtxtDumpEntityDecl()
677 fprintf(ctxt->output, ", external parameter\n"); in xmlCtxtDumpEntityDecl()
680 fprintf(ctxt->output, ", predefined\n"); in xmlCtxtDumpEntityDecl()
683 if (ent->ExternalID) { in xmlCtxtDumpEntityDecl()
685 fprintf(ctxt->output, " ExternalID=%s\n", in xmlCtxtDumpEntityDecl()
686 (char *) ent->ExternalID); in xmlCtxtDumpEntityDecl()
688 if (ent->SystemID) { in xmlCtxtDumpEntityDecl()
690 fprintf(ctxt->output, " SystemID=%s\n", in xmlCtxtDumpEntityDecl()
691 (char *) ent->SystemID); in xmlCtxtDumpEntityDecl()
693 if (ent->URI != NULL) { in xmlCtxtDumpEntityDecl()
695 fprintf(ctxt->output, " URI=%s\n", (char *) ent->URI); in xmlCtxtDumpEntityDecl()
697 if (ent->content) { in xmlCtxtDumpEntityDecl()
699 fprintf(ctxt->output, " content="); in xmlCtxtDumpEntityDecl()
700 xmlCtxtDumpString(ctxt, ent->content); in xmlCtxtDumpEntityDecl()
701 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntityDecl()
717 if (!ctxt->check) in xmlCtxtDumpNamespace()
718 fprintf(ctxt->output, "namespace node is NULL\n"); in xmlCtxtDumpNamespace()
721 if (ns->type != XML_NAMESPACE_DECL) { in xmlCtxtDumpNamespace()
726 if (ns->href == NULL) { in xmlCtxtDumpNamespace()
727 if (ns->prefix != NULL) in xmlCtxtDumpNamespace()
730 (char *) ns->prefix); in xmlCtxtDumpNamespace()
735 if (!ctxt->check) { in xmlCtxtDumpNamespace()
736 if (ns->prefix != NULL) in xmlCtxtDumpNamespace()
737 fprintf(ctxt->output, "namespace %s href=", in xmlCtxtDumpNamespace()
738 (char *) ns->prefix); in xmlCtxtDumpNamespace()
740 fprintf(ctxt->output, "default namespace href="); in xmlCtxtDumpNamespace()
742 xmlCtxtDumpString(ctxt, ns->href); in xmlCtxtDumpNamespace()
743 fprintf(ctxt->output, "\n"); in xmlCtxtDumpNamespace()
753 ns = ns->next; in xmlCtxtDumpNamespaceList()
763 if (!ctxt->check) in xmlCtxtDumpEntity()
764 fprintf(ctxt->output, "Entity is NULL\n"); in xmlCtxtDumpEntity()
767 if (!ctxt->check) { in xmlCtxtDumpEntity()
768 switch (ent->etype) { in xmlCtxtDumpEntity()
770 fprintf(ctxt->output, "INTERNAL_GENERAL_ENTITY "); in xmlCtxtDumpEntity()
773 fprintf(ctxt->output, "EXTERNAL_GENERAL_PARSED_ENTITY "); in xmlCtxtDumpEntity()
776 fprintf(ctxt->output, "EXTERNAL_GENERAL_UNPARSED_ENTITY "); in xmlCtxtDumpEntity()
779 fprintf(ctxt->output, "INTERNAL_PARAMETER_ENTITY "); in xmlCtxtDumpEntity()
782 fprintf(ctxt->output, "EXTERNAL_PARAMETER_ENTITY "); in xmlCtxtDumpEntity()
785 fprintf(ctxt->output, "ENTITY_%d ! ", (int) ent->etype); in xmlCtxtDumpEntity()
787 fprintf(ctxt->output, "%s\n", ent->name); in xmlCtxtDumpEntity()
788 if (ent->ExternalID) { in xmlCtxtDumpEntity()
790 fprintf(ctxt->output, "ExternalID=%s\n", in xmlCtxtDumpEntity()
791 (char *) ent->ExternalID); in xmlCtxtDumpEntity()
793 if (ent->SystemID) { in xmlCtxtDumpEntity()
795 fprintf(ctxt->output, "SystemID=%s\n", (char *) ent->SystemID); in xmlCtxtDumpEntity()
797 if (ent->URI) { in xmlCtxtDumpEntity()
799 fprintf(ctxt->output, "URI=%s\n", (char *) ent->URI); in xmlCtxtDumpEntity()
801 if (ent->content) { in xmlCtxtDumpEntity()
803 fprintf(ctxt->output, "content="); in xmlCtxtDumpEntity()
804 xmlCtxtDumpString(ctxt, ent->content); in xmlCtxtDumpEntity()
805 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntity()
812 * @output: the FILE * for the output
824 if (!ctxt->check) in xmlCtxtDumpAttr()
825 fprintf(ctxt->output, "Attr is NULL"); in xmlCtxtDumpAttr()
828 if (!ctxt->check) { in xmlCtxtDumpAttr()
829 fprintf(ctxt->output, "ATTRIBUTE "); in xmlCtxtDumpAttr()
830 xmlCtxtDumpString(ctxt, attr->name); in xmlCtxtDumpAttr()
831 fprintf(ctxt->output, "\n"); in xmlCtxtDumpAttr()
832 if (attr->children != NULL) { in xmlCtxtDumpAttr()
833 ctxt->depth++; in xmlCtxtDumpAttr()
834 xmlCtxtDumpNodeList(ctxt, attr->children); in xmlCtxtDumpAttr()
835 ctxt->depth--; in xmlCtxtDumpAttr()
838 if (attr->name == NULL) in xmlCtxtDumpAttr()
850 * @output: the FILE * for the output
861 attr = attr->next; in xmlCtxtDumpAttrList()
867 * @output: the FILE * for the output
877 if (!ctxt->check) { in xmlCtxtDumpOneNode()
879 fprintf(ctxt->output, "node is NULL\n"); in xmlCtxtDumpOneNode()
883 ctxt->node = node; in xmlCtxtDumpOneNode()
885 switch (node->type) { in xmlCtxtDumpOneNode()
887 if (!ctxt->check) { in xmlCtxtDumpOneNode()
889 fprintf(ctxt->output, "ELEMENT "); in xmlCtxtDumpOneNode()
890 if ((node->ns != NULL) && (node->ns->prefix != NULL)) { in xmlCtxtDumpOneNode()
891 xmlCtxtDumpString(ctxt, node->ns->prefix); in xmlCtxtDumpOneNode()
892 fprintf(ctxt->output, ":"); in xmlCtxtDumpOneNode()
894 xmlCtxtDumpString(ctxt, node->name); in xmlCtxtDumpOneNode()
895 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
899 if (!ctxt->check) in xmlCtxtDumpOneNode()
901 fprintf(ctxt->output, "Error, ATTRIBUTE found here\n"); in xmlCtxtDumpOneNode()
905 if (!ctxt->check) { in xmlCtxtDumpOneNode()
907 if (node->name == (const xmlChar *) xmlStringTextNoenc) in xmlCtxtDumpOneNode()
908 fprintf(ctxt->output, "TEXT no enc"); in xmlCtxtDumpOneNode()
910 fprintf(ctxt->output, "TEXT"); in xmlCtxtDumpOneNode()
911 if (ctxt->options & DUMP_TEXT_TYPE) { in xmlCtxtDumpOneNode()
912 if (node->content == (xmlChar *) &(node->properties)) in xmlCtxtDumpOneNode()
913 fprintf(ctxt->output, " compact\n"); in xmlCtxtDumpOneNode()
914 else if (xmlDictOwns(ctxt->dict, node->content) == 1) in xmlCtxtDumpOneNode()
915 fprintf(ctxt->output, " interned\n"); in xmlCtxtDumpOneNode()
917 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
919 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
923 if (!ctxt->check) { in xmlCtxtDumpOneNode()
925 fprintf(ctxt->output, "CDATA_SECTION\n"); in xmlCtxtDumpOneNode()
929 if (!ctxt->check) { in xmlCtxtDumpOneNode()
931 fprintf(ctxt->output, "ENTITY_REF(%s)\n", in xmlCtxtDumpOneNode()
932 (char *) node->name); in xmlCtxtDumpOneNode()
936 if (!ctxt->check) { in xmlCtxtDumpOneNode()
938 fprintf(ctxt->output, "ENTITY\n"); in xmlCtxtDumpOneNode()
942 if (!ctxt->check) { in xmlCtxtDumpOneNode()
944 fprintf(ctxt->output, "PI %s\n", (char *) node->name); in xmlCtxtDumpOneNode()
948 if (!ctxt->check) { in xmlCtxtDumpOneNode()
950 fprintf(ctxt->output, "COMMENT\n"); in xmlCtxtDumpOneNode()
955 if (!ctxt->check) { in xmlCtxtDumpOneNode()
958 fprintf(ctxt->output, "Error, DOCUMENT found here\n"); in xmlCtxtDumpOneNode()
962 if (!ctxt->check) { in xmlCtxtDumpOneNode()
964 fprintf(ctxt->output, "DOCUMENT_TYPE\n"); in xmlCtxtDumpOneNode()
968 if (!ctxt->check) { in xmlCtxtDumpOneNode()
970 fprintf(ctxt->output, "DOCUMENT_FRAG\n"); in xmlCtxtDumpOneNode()
974 if (!ctxt->check) { in xmlCtxtDumpOneNode()
976 fprintf(ctxt->output, "NOTATION\n"); in xmlCtxtDumpOneNode()
995 if (!ctxt->check) { in xmlCtxtDumpOneNode()
997 fprintf(ctxt->output, "INCLUDE START\n"); in xmlCtxtDumpOneNode()
1001 if (!ctxt->check) { in xmlCtxtDumpOneNode()
1003 fprintf(ctxt->output, "INCLUDE END\n"); in xmlCtxtDumpOneNode()
1007 if (!ctxt->check) in xmlCtxtDumpOneNode()
1010 "Unknown node type %d\n", node->type); in xmlCtxtDumpOneNode()
1013 if (node->doc == NULL) { in xmlCtxtDumpOneNode()
1014 if (!ctxt->check) { in xmlCtxtDumpOneNode()
1017 fprintf(ctxt->output, "PBM: doc == NULL !!!\n"); in xmlCtxtDumpOneNode()
1019 ctxt->depth++; in xmlCtxtDumpOneNode()
1020 if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL)) in xmlCtxtDumpOneNode()
1021 xmlCtxtDumpNamespaceList(ctxt, node->nsDef); in xmlCtxtDumpOneNode()
1022 if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL)) in xmlCtxtDumpOneNode()
1023 xmlCtxtDumpAttrList(ctxt, node->properties); in xmlCtxtDumpOneNode()
1024 if (node->type != XML_ENTITY_REF_NODE) { in xmlCtxtDumpOneNode()
1025 if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) { in xmlCtxtDumpOneNode()
1026 if (!ctxt->check) { in xmlCtxtDumpOneNode()
1028 fprintf(ctxt->output, "content="); in xmlCtxtDumpOneNode()
1029 xmlCtxtDumpString(ctxt, node->content); in xmlCtxtDumpOneNode()
1030 fprintf(ctxt->output, "\n"); in xmlCtxtDumpOneNode()
1036 ent = xmlGetDocEntity(node->doc, node->name); in xmlCtxtDumpOneNode()
1040 ctxt->depth--; in xmlCtxtDumpOneNode()
1050 * @output: the FILE * for the output
1060 if (!ctxt->check) { in xmlCtxtDumpNode()
1062 fprintf(ctxt->output, "node is NULL\n"); in xmlCtxtDumpNode()
1067 if ((node->type != XML_NAMESPACE_DECL) && in xmlCtxtDumpNode()
1068 (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) { in xmlCtxtDumpNode()
1069 ctxt->depth++; in xmlCtxtDumpNode()
1070 xmlCtxtDumpNodeList(ctxt, node->children); in xmlCtxtDumpNode()
1071 ctxt->depth--; in xmlCtxtDumpNode()
1077 * @output: the FILE * for the output
1088 node = node->next; in xmlCtxtDumpNodeList()
1096 if (!ctxt->check) in xmlCtxtDumpDocHead()
1097 fprintf(ctxt->output, "DOCUMENT == NULL !\n"); in xmlCtxtDumpDocHead()
1100 ctxt->node = (xmlNodePtr) doc; in xmlCtxtDumpDocHead()
1102 switch (doc->type) { in xmlCtxtDumpDocHead()
1136 if (!ctxt->check) in xmlCtxtDumpDocHead()
1137 fprintf(ctxt->output, "DOCUMENT\n"); in xmlCtxtDumpDocHead()
1140 if (!ctxt->check) in xmlCtxtDumpDocHead()
1141 fprintf(ctxt->output, "HTML DOCUMENT\n"); in xmlCtxtDumpDocHead()
1157 "Unknown node type %d\n", doc->type); in xmlCtxtDumpDocHead()
1163 * @output: the FILE * for the output
1164 * @doc: the document
1166 * Dumps debug information concerning the document, not recursive
1173 if (!ctxt->check) { in xmlCtxtDumpDocumentHead()
1174 if (doc->name != NULL) { in xmlCtxtDumpDocumentHead()
1175 fprintf(ctxt->output, "name="); in xmlCtxtDumpDocumentHead()
1176 xmlCtxtDumpString(ctxt, BAD_CAST doc->name); in xmlCtxtDumpDocumentHead()
1177 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1179 if (doc->version != NULL) { in xmlCtxtDumpDocumentHead()
1180 fprintf(ctxt->output, "version="); in xmlCtxtDumpDocumentHead()
1181 xmlCtxtDumpString(ctxt, doc->version); in xmlCtxtDumpDocumentHead()
1182 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1184 if (doc->encoding != NULL) { in xmlCtxtDumpDocumentHead()
1185 fprintf(ctxt->output, "encoding="); in xmlCtxtDumpDocumentHead()
1186 xmlCtxtDumpString(ctxt, doc->encoding); in xmlCtxtDumpDocumentHead()
1187 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1189 if (doc->URL != NULL) { in xmlCtxtDumpDocumentHead()
1190 fprintf(ctxt->output, "URL="); in xmlCtxtDumpDocumentHead()
1191 xmlCtxtDumpString(ctxt, doc->URL); in xmlCtxtDumpDocumentHead()
1192 fprintf(ctxt->output, "\n"); in xmlCtxtDumpDocumentHead()
1194 if (doc->standalone) in xmlCtxtDumpDocumentHead()
1195 fprintf(ctxt->output, "standalone=true\n"); in xmlCtxtDumpDocumentHead()
1197 if (doc->oldNs != NULL) in xmlCtxtDumpDocumentHead()
1198 xmlCtxtDumpNamespaceList(ctxt, doc->oldNs); in xmlCtxtDumpDocumentHead()
1203 * @output: the FILE * for the output
1204 * @doc: the document
1206 * Dumps debug information for the document, it's recursive
1212 if (!ctxt->check) in xmlCtxtDumpDocument()
1213 fprintf(ctxt->output, "DOCUMENT == NULL !\n"); in xmlCtxtDumpDocument()
1217 if (((doc->type == XML_DOCUMENT_NODE) || in xmlCtxtDumpDocument()
1218 (doc->type == XML_HTML_DOCUMENT_NODE)) in xmlCtxtDumpDocument()
1219 && (doc->children != NULL)) { in xmlCtxtDumpDocument()
1220 ctxt->depth++; in xmlCtxtDumpDocument()
1221 xmlCtxtDumpNodeList(ctxt, doc->children); in xmlCtxtDumpDocument()
1222 ctxt->depth--; in xmlCtxtDumpDocument()
1233 if (!ctxt->check) in xmlCtxtDumpEntityCallback()
1234 fprintf(ctxt->output, "Entity is NULL"); in xmlCtxtDumpEntityCallback()
1237 if (!ctxt->check) { in xmlCtxtDumpEntityCallback()
1238 fprintf(ctxt->output, "%s : ", (char *) cur->name); in xmlCtxtDumpEntityCallback()
1239 switch (cur->etype) { in xmlCtxtDumpEntityCallback()
1241 fprintf(ctxt->output, "INTERNAL GENERAL, "); in xmlCtxtDumpEntityCallback()
1244 fprintf(ctxt->output, "EXTERNAL PARSED, "); in xmlCtxtDumpEntityCallback()
1247 fprintf(ctxt->output, "EXTERNAL UNPARSED, "); in xmlCtxtDumpEntityCallback()
1250 fprintf(ctxt->output, "INTERNAL PARAMETER, "); in xmlCtxtDumpEntityCallback()
1253 fprintf(ctxt->output, "EXTERNAL PARAMETER, "); in xmlCtxtDumpEntityCallback()
1257 "Unknown entity type %d\n", cur->etype); in xmlCtxtDumpEntityCallback()
1259 if (cur->ExternalID != NULL) in xmlCtxtDumpEntityCallback()
1260 fprintf(ctxt->output, "ID \"%s\"", (char *) cur->ExternalID); in xmlCtxtDumpEntityCallback()
1261 if (cur->SystemID != NULL) in xmlCtxtDumpEntityCallback()
1262 fprintf(ctxt->output, "SYSTEM \"%s\"", (char *) cur->SystemID); in xmlCtxtDumpEntityCallback()
1263 if (cur->orig != NULL) in xmlCtxtDumpEntityCallback()
1264 fprintf(ctxt->output, "\n orig \"%s\"", (char *) cur->orig); in xmlCtxtDumpEntityCallback()
1265 if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) in xmlCtxtDumpEntityCallback()
1266 fprintf(ctxt->output, "\n content \"%s\"", in xmlCtxtDumpEntityCallback()
1267 (char *) cur->content); in xmlCtxtDumpEntityCallback()
1268 fprintf(ctxt->output, "\n"); in xmlCtxtDumpEntityCallback()
1274 * @output: the FILE * for the output
1275 * @doc: the document
1277 * Dumps debug information for all the entities in use by the document
1284 if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { in xmlCtxtDumpEntities()
1286 doc->intSubset->entities; in xmlCtxtDumpEntities()
1288 if (!ctxt->check) in xmlCtxtDumpEntities()
1289 fprintf(ctxt->output, "Entities in internal subset\n"); in xmlCtxtDumpEntities()
1292 fprintf(ctxt->output, "No entities in internal subset\n"); in xmlCtxtDumpEntities()
1293 if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { in xmlCtxtDumpEntities()
1295 doc->extSubset->entities; in xmlCtxtDumpEntities()
1297 if (!ctxt->check) in xmlCtxtDumpEntities()
1298 fprintf(ctxt->output, "Entities in external subset\n"); in xmlCtxtDumpEntities()
1300 } else if (!ctxt->check) in xmlCtxtDumpEntities()
1301 fprintf(ctxt->output, "No entities in external subset\n"); in xmlCtxtDumpEntities()
1306 * @output: the FILE * for the output
1315 if (!ctxt->check) in xmlCtxtDumpDTD()
1316 fprintf(ctxt->output, "DTD is NULL\n"); in xmlCtxtDumpDTD()
1320 if (dtd->children == NULL) in xmlCtxtDumpDTD()
1321 fprintf(ctxt->output, " DTD is empty\n"); in xmlCtxtDumpDTD()
1323 ctxt->depth++; in xmlCtxtDumpDTD()
1324 xmlCtxtDumpNodeList(ctxt, dtd->children); in xmlCtxtDumpDTD()
1325 ctxt->depth--; in xmlCtxtDumpDTD()
1337 * @output: the FILE * for the output
1343 xmlDebugDumpString(FILE * output, const xmlChar * str) in xmlDebugDumpString() argument
1347 if (output == NULL) in xmlDebugDumpString()
1348 output = stdout; in xmlDebugDumpString()
1350 fprintf(output, "(NULL)"); in xmlDebugDumpString()
1357 fputc(' ', output); in xmlDebugDumpString()
1359 fprintf(output, "#%X", str[i]); in xmlDebugDumpString()
1361 fputc(str[i], output); in xmlDebugDumpString()
1362 fprintf(output, "..."); in xmlDebugDumpString()
1367 * @output: the FILE * for the output
1374 xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) { in xmlDebugDumpAttr() argument
1377 if (output == NULL) return; in xmlDebugDumpAttr()
1379 ctxt.output = output; in xmlDebugDumpAttr()
1388 * @output: the FILE * for the output
1389 * @doc: the document
1391 * Dumps debug information for all the entities in use by the document
1394 xmlDebugDumpEntities(FILE * output, xmlDocPtr doc) in xmlDebugDumpEntities() argument
1398 if (output == NULL) return; in xmlDebugDumpEntities()
1400 ctxt.output = output; in xmlDebugDumpEntities()
1407 * @output: the FILE * for the output
1414 xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth) in xmlDebugDumpAttrList() argument
1418 if (output == NULL) return; in xmlDebugDumpAttrList()
1420 ctxt.output = output; in xmlDebugDumpAttrList()
1428 * @output: the FILE * for the output
1435 xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpOneNode() argument
1439 if (output == NULL) return; in xmlDebugDumpOneNode()
1441 ctxt.output = output; in xmlDebugDumpOneNode()
1449 * @output: the FILE * for the output
1456 xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpNode() argument
1460 if (output == NULL) in xmlDebugDumpNode()
1461 output = stdout; in xmlDebugDumpNode()
1463 ctxt.output = output; in xmlDebugDumpNode()
1471 * @output: the FILE * for the output
1478 xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth) in xmlDebugDumpNodeList() argument
1482 if (output == NULL) in xmlDebugDumpNodeList()
1483 output = stdout; in xmlDebugDumpNodeList()
1485 ctxt.output = output; in xmlDebugDumpNodeList()
1493 * @output: the FILE * for the output
1494 * @doc: the document
1496 * Dumps debug information concerning the document, not recursive
1499 xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc) in xmlDebugDumpDocumentHead() argument
1503 if (output == NULL) in xmlDebugDumpDocumentHead()
1504 output = stdout; in xmlDebugDumpDocumentHead()
1507 ctxt.output = output; in xmlDebugDumpDocumentHead()
1514 * @output: the FILE * for the output
1515 * @doc: the document
1517 * Dumps debug information for the document, it's recursive
1520 xmlDebugDumpDocument(FILE * output, xmlDocPtr doc) in xmlDebugDumpDocument() argument
1524 if (output == NULL) in xmlDebugDumpDocument()
1525 output = stdout; in xmlDebugDumpDocument()
1528 ctxt.output = output; in xmlDebugDumpDocument()
1535 * @output: the FILE * for the output
1541 xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd) in xmlDebugDumpDTD() argument
1545 if (output == NULL) in xmlDebugDumpDTD()
1546 output = stdout; in xmlDebugDumpDTD()
1549 ctxt.output = output; in xmlDebugDumpDTD()
1562 * @output: the FILE * for the output
1563 * @doc: the document
1565 * Check the document for potential content problems, and output
1566 * the errors to @output
1571 xmlDebugCheckDocument(FILE * output, xmlDocPtr doc) in xmlDebugCheckDocument() argument
1575 if (output == NULL) in xmlDebugCheckDocument()
1576 output = stdout; in xmlDebugCheckDocument()
1578 ctxt.output = output; in xmlDebugCheckDocument()
1607 switch (node->type) { in xmlLsCountNode()
1609 list = node->children; in xmlLsCountNode()
1613 list = ((xmlDocPtr) node)->children; in xmlLsCountNode()
1616 list = ((xmlAttrPtr) node)->children; in xmlLsCountNode()
1622 if (node->content != NULL) { in xmlLsCountNode()
1623 ret = xmlStrlen(node->content); in xmlLsCountNode()
1642 list = list->next; in xmlLsCountNode()
1648 * @output: the FILE * for the output
1651 * Dump to @output the type and name of @node.
1654 xmlLsOneNode(FILE *output, xmlNodePtr node) { in xmlLsOneNode() argument
1655 if (output == NULL) return; in xmlLsOneNode()
1657 fprintf(output, "NULL\n"); in xmlLsOneNode()
1660 switch (node->type) { in xmlLsOneNode()
1662 fprintf(output, "-"); in xmlLsOneNode()
1665 fprintf(output, "a"); in xmlLsOneNode()
1668 fprintf(output, "t"); in xmlLsOneNode()
1671 fprintf(output, "C"); in xmlLsOneNode()
1674 fprintf(output, "e"); in xmlLsOneNode()
1677 fprintf(output, "E"); in xmlLsOneNode()
1680 fprintf(output, "p"); in xmlLsOneNode()
1683 fprintf(output, "c"); in xmlLsOneNode()
1686 fprintf(output, "d"); in xmlLsOneNode()
1689 fprintf(output, "h"); in xmlLsOneNode()
1692 fprintf(output, "T"); in xmlLsOneNode()
1695 fprintf(output, "F"); in xmlLsOneNode()
1698 fprintf(output, "N"); in xmlLsOneNode()
1701 fprintf(output, "n"); in xmlLsOneNode()
1704 fprintf(output, "?"); in xmlLsOneNode()
1706 if (node->type != XML_NAMESPACE_DECL) { in xmlLsOneNode()
1707 if (node->properties != NULL) in xmlLsOneNode()
1708 fprintf(output, "a"); in xmlLsOneNode()
1710 fprintf(output, "-"); in xmlLsOneNode()
1711 if (node->nsDef != NULL) in xmlLsOneNode()
1712 fprintf(output, "n"); in xmlLsOneNode()
1714 fprintf(output, "-"); in xmlLsOneNode()
1717 fprintf(output, " %8d ", xmlLsCountNode(node)); in xmlLsOneNode()
1719 switch (node->type) { in xmlLsOneNode()
1721 if (node->name != NULL) { in xmlLsOneNode()
1722 if ((node->ns != NULL) && (node->ns->prefix != NULL)) in xmlLsOneNode()
1723 fprintf(output, "%s:", node->ns->prefix); in xmlLsOneNode()
1724 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1728 if (node->name != NULL) in xmlLsOneNode()
1729 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1732 if (node->content != NULL) { in xmlLsOneNode()
1733 xmlDebugDumpString(output, node->content); in xmlLsOneNode()
1739 if (node->name != NULL) in xmlLsOneNode()
1740 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1743 if (node->name != NULL) in xmlLsOneNode()
1744 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1747 if (node->name != NULL) in xmlLsOneNode()
1748 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1765 if (ns->prefix == NULL) in xmlLsOneNode()
1766 fprintf(output, "default -> %s", (char *)ns->href); in xmlLsOneNode()
1768 fprintf(output, "%s -> %s", (char *)ns->prefix, in xmlLsOneNode()
1769 (char *)ns->href); in xmlLsOneNode()
1773 if (node->name != NULL) in xmlLsOneNode()
1774 fprintf(output, "%s", (const char *) node->name); in xmlLsOneNode()
1776 fprintf(output, "\n"); in xmlLsOneNode()
1807 * - allow to shell out an editor on a subpart
1808 * - cleanup function registrations (with help) and calling
1809 * - provide registration routines
1861 "%s is user-defined\n", arg); in xmlShellPrintXPathError()
1879 * @ctxt : a non-null shell context
1880 * @node : a non-null node to print to the output FILE
1882 * Print node to the output FILE
1894 fp = ctxt->output; in xmlShellPrintNodeCtxt()
1896 if (node->type == XML_DOCUMENT_NODE) in xmlShellPrintNodeCtxt()
1898 else if (node->type == XML_ATTRIBUTE_NODE) in xmlShellPrintNodeCtxt()
1901 xmlElemDump(fp, node->doc, node); in xmlShellPrintNodeCtxt()
1908 * @node : a non-null node to print to the output FILE
1910 * Print node to the output FILE
1924 * Prints result to the output FILE
1933 switch (list->type) { in xmlShellPrintXPathResultCtxt()
1938 if (list->nodesetval) { in xmlShellPrintXPathResultCtxt()
1939 for (indx = 0; indx < list->nodesetval->nodeNr; in xmlShellPrintXPathResultCtxt()
1942 list->nodesetval->nodeTab[indx]); in xmlShellPrintXPathResultCtxt()
1957 xmlBoolToText(list->boolval)); in xmlShellPrintXPathResultCtxt()
1961 "Is a number:%0g\n", list->floatval); in xmlShellPrintXPathResultCtxt()
1965 "Is a string:%s\n", list->stringval); in xmlShellPrintXPathResultCtxt()
1969 xmlShellPrintXPathError(list->type, NULL); in xmlShellPrintXPathResultCtxt()
1978 * Prints result to the output FILE
2007 fprintf(ctxt->output, "NULL\n"); in xmlShellList()
2010 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellList()
2011 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellList()
2012 cur = ((xmlDocPtr) node)->children; in xmlShellList()
2013 } else if (node->type == XML_NAMESPACE_DECL) { in xmlShellList()
2014 xmlLsOneNode(ctxt->output, node); in xmlShellList()
2016 } else if (node->children != NULL) { in xmlShellList()
2017 cur = node->children; in xmlShellList()
2019 xmlLsOneNode(ctxt->output, node); in xmlShellList()
2023 xmlLsOneNode(ctxt->output, cur); in xmlShellList()
2024 cur = cur->next; in xmlShellList()
2050 fprintf(ctxt->output, "NULL\n"); in xmlShellBase()
2054 base = xmlNodeGetBase(node->doc, node); in xmlShellBase()
2057 fprintf(ctxt->output, " No base found !!!\n"); in xmlShellBase()
2059 fprintf(ctxt->output, "%s\n", base); in xmlShellBase()
2122 fprintf(ctxt->output, "setns: prefix=[nsuri] required\n"); in xmlShellRegisterNamespace()
2124 return(-1); in xmlShellRegisterNamespace()
2136 if(xmlXPathRegisterNs(ctxt->pctxt, prefix, href) != 0) { in xmlShellRegisterNamespace()
2137 …fprintf(ctxt->output,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", prefix, … in xmlShellRegisterNamespace()
2139 return(-1); in xmlShellRegisterNamespace()
2164 if ((root == NULL) || (root->type != XML_ELEMENT_NODE) || in xmlShellRegisterRootNamespaces()
2165 (root->nsDef == NULL) || (ctxt == NULL) || (ctxt->pctxt == NULL)) in xmlShellRegisterRootNamespaces()
2166 return(-1); in xmlShellRegisterRootNamespaces()
2167 ns = root->nsDef; in xmlShellRegisterRootNamespaces()
2169 if (ns->prefix == NULL) in xmlShellRegisterRootNamespaces()
2170 xmlXPathRegisterNs(ctxt->pctxt, BAD_CAST "defaultns", ns->href); in xmlShellRegisterRootNamespaces()
2172 xmlXPathRegisterNs(ctxt->pctxt, ns->prefix, ns->href); in xmlShellRegisterRootNamespaces()
2173 ns = ns->next; in xmlShellRegisterRootNamespaces()
2209 if (node->type == XML_COMMENT_NODE) { in xmlShellGrep()
2210 if (xmlStrstr(node->content, (xmlChar *) arg)) { in xmlShellGrep()
2212 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node)); in xmlShellGrep()
2215 } else if (node->type == XML_TEXT_NODE) { in xmlShellGrep()
2216 if (xmlStrstr(node->content, (xmlChar *) arg)) { in xmlShellGrep()
2218 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent)); in xmlShellGrep()
2219 xmlShellList(ctxt, NULL, node->parent, NULL); in xmlShellGrep()
2227 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellGrep()
2228 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellGrep()
2229 node = ((xmlDocPtr) node)->children; in xmlShellGrep()
2230 } else if ((node->children != NULL) in xmlShellGrep()
2231 && (node->type != XML_ENTITY_REF_NODE)) { in xmlShellGrep()
2233 node = node->children; in xmlShellGrep()
2234 } else if (node->next != NULL) { in xmlShellGrep()
2236 node = node->next; in xmlShellGrep()
2238 /* go up to parents->next if needed */ in xmlShellGrep()
2240 if (node->parent != NULL) { in xmlShellGrep()
2241 node = node->parent; in xmlShellGrep()
2243 if (node->next != NULL) { in xmlShellGrep()
2244 node = node->next; in xmlShellGrep()
2247 if (node->parent == NULL) { in xmlShellGrep()
2277 fprintf(ctxt->output, "NULL\n"); in xmlShellDir()
2280 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDir()
2281 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDir()
2282 xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node); in xmlShellDir()
2283 } else if (node->type == XML_ATTRIBUTE_NODE) { in xmlShellDir()
2284 xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0); in xmlShellDir()
2286 xmlDebugDumpOneNode(ctxt->output, node, 0); in xmlShellDir()
2314 fprintf(ctxt->output, "NULL\n"); in xmlShellSetContent()
2318 fprintf(ctxt->output, "NULL\n"); in xmlShellSetContent()
2324 if (node->children != NULL) { in xmlShellSetContent()
2325 xmlFreeNodeList(node->children); in xmlShellSetContent()
2326 node->children = NULL; in xmlShellSetContent()
2327 node->last = NULL; in xmlShellSetContent()
2331 fprintf(ctxt->output, "failed to parse content\n"); in xmlShellSetContent()
2340 * @schemas: the path to the Relax-NG schemas
2345 * validating the instance against a Relax-NG schemas
2365 "Relax-NG schema %s failed to compile\n", schemas); in xmlShellRNGValidate()
2366 return(-1); in xmlShellRNGValidate()
2370 ret = xmlRelaxNGValidateDoc(vctxt, sctxt->doc); in xmlShellRNGValidate()
2372 fprintf(stderr, "%s validates\n", sctxt->filename); in xmlShellRNGValidate()
2374 fprintf(stderr, "%s fails to validate\n", sctxt->filename); in xmlShellRNGValidate()
2377 sctxt->filename); in xmlShellRNGValidate()
2406 fprintf(ctxt->output, "NULL\n"); in xmlShellCat()
2409 if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) { in xmlShellCat()
2411 if (node->type == XML_HTML_DOCUMENT_NODE) in xmlShellCat()
2412 htmlDocDump(ctxt->output, (htmlDocPtr) node); in xmlShellCat()
2414 htmlNodeDumpFile(ctxt->output, ctxt->doc, node); in xmlShellCat()
2416 if (node->type == XML_DOCUMENT_NODE) in xmlShellCat()
2417 xmlDocDump(ctxt->output, (xmlDocPtr) node); in xmlShellCat()
2419 xmlElemDump(ctxt->output, ctxt->doc, node); in xmlShellCat()
2422 if (node->type == XML_DOCUMENT_NODE) in xmlShellCat()
2423 xmlDocDump(ctxt->output, (xmlDocPtr) node); in xmlShellCat()
2425 xmlElemDump(ctxt->output, ctxt->doc, node); in xmlShellCat()
2427 fprintf(ctxt->output, "\n"); in xmlShellCat()
2440 * loads a new document specified by the filename
2442 * Returns 0 or -1 if loading failed
2452 if ((ctxt == NULL) || (filename == NULL)) return(-1); in xmlShellLoad()
2453 if (ctxt->doc != NULL) in xmlShellLoad()
2454 html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE); in xmlShellLoad()
2460 fprintf(ctxt->output, "HTML support not compiled in\n"); in xmlShellLoad()
2467 if (ctxt->loaded == 1) { in xmlShellLoad()
2468 xmlFreeDoc(ctxt->doc); in xmlShellLoad()
2470 ctxt->loaded = 1; in xmlShellLoad()
2472 xmlXPathFreeContext(ctxt->pctxt); in xmlShellLoad()
2474 xmlFree(ctxt->filename); in xmlShellLoad()
2475 ctxt->doc = doc; in xmlShellLoad()
2476 ctxt->node = (xmlNodePtr) doc; in xmlShellLoad()
2478 ctxt->pctxt = xmlXPathNewContext(doc); in xmlShellLoad()
2480 ctxt->filename = (char *) xmlCanonicPath((xmlChar *) filename); in xmlShellLoad()
2482 return (-1); in xmlShellLoad()
2498 * Returns 0 or -1 in case of error
2505 return (-1); in xmlShellWrite()
2507 return (-1); in xmlShellWrite()
2513 return (-1); in xmlShellWrite()
2516 switch (node->type) { in xmlShellWrite()
2518 if (xmlSaveFile((char *) filename, ctxt->doc) < -1) { in xmlShellWrite()
2521 return (-1); in xmlShellWrite()
2526 if (htmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellWrite()
2529 return (-1); in xmlShellWrite()
2532 if (xmlSaveFile((char *) filename, ctxt->doc) < -1) { in xmlShellWrite()
2535 return (-1); in xmlShellWrite()
2546 return (-1); in xmlShellWrite()
2548 xmlElemDump(f, ctxt->doc, node); in xmlShellWrite()
2563 * Write the current document to the filename, or it's original name
2565 * Returns 0 or -1 in case of error
2572 if ((ctxt == NULL) || (ctxt->doc == NULL)) in xmlShellSave()
2573 return (-1); in xmlShellSave()
2575 filename = ctxt->filename; in xmlShellSave()
2577 return (-1); in xmlShellSave()
2582 return (-1); in xmlShellSave()
2585 switch (ctxt->doc->type) { in xmlShellSave()
2587 if (xmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2594 if (htmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2599 if (xmlSaveFile((char *) filename, ctxt->doc) < 0) { in xmlShellSave()
2607 "To save to subparts of a document use the 'write' command\n"); in xmlShellSave()
2608 return (-1); in xmlShellSave()
2624 * Validate the document, if a DTD path is provided, then the validation
2627 * Returns 0 or -1 in case of error
2635 int res = -1; in xmlShellValidate()
2637 if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1); in xmlShellValidate()
2643 res = xmlValidateDocument(&vctxt, ctxt->doc); in xmlShellValidate()
2649 res = xmlValidateDtd(&vctxt, ctxt->doc, subset); in xmlShellValidate()
2669 * Returns 0 or -1 in case of error
2680 return (-1); in xmlShellDu()
2683 return (-1); in xmlShellDu()
2686 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDu()
2687 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDu()
2688 fprintf(ctxt->output, "/\n"); in xmlShellDu()
2689 } else if (node->type == XML_ELEMENT_NODE) { in xmlShellDu()
2691 fprintf(ctxt->output, " "); in xmlShellDu()
2692 if ((node->ns) && (node->ns->prefix)) in xmlShellDu()
2693 fprintf(ctxt->output, "%s:", node->ns->prefix); in xmlShellDu()
2694 fprintf(ctxt->output, "%s\n", node->name); in xmlShellDu()
2702 if ((node->type == XML_DOCUMENT_NODE) || in xmlShellDu()
2703 (node->type == XML_HTML_DOCUMENT_NODE)) { in xmlShellDu()
2704 node = ((xmlDocPtr) node)->children; in xmlShellDu()
2705 } else if ((node->children != NULL) in xmlShellDu()
2706 && (node->type != XML_ENTITY_REF_NODE)) { in xmlShellDu()
2708 node = node->children; in xmlShellDu()
2710 } else if ((node != tree) && (node->next != NULL)) { in xmlShellDu()
2712 node = node->next; in xmlShellDu()
2714 /* go up to parents->next if needed */ in xmlShellDu()
2716 if (node->parent != NULL) { in xmlShellDu()
2717 node = node->parent; in xmlShellDu()
2718 indent--; in xmlShellDu()
2720 if ((node != tree) && (node->next != NULL)) { in xmlShellDu()
2721 node = node->next; in xmlShellDu()
2724 if (node->parent == NULL) { in xmlShellDu()
2745 * @buffer: the output buffer
2752 * The output is compatible with XPath commands.
2754 * Returns 0 or -1 in case of error
2763 return (-1); in xmlShellPwd()
2767 return (-1); in xmlShellPwd()
2786 * @doc: the initial document
2787 * @filename: the output buffer
2789 * @output: the output FILE*, defaults to stdout if NULL
2792 * This allow to load, validate, view, modify and save a document
2797 FILE * output) in xmlShell() argument
2813 if (output == NULL) in xmlShell()
2814 output = stdout; in xmlShell()
2818 ctxt->loaded = 0; in xmlShell()
2819 ctxt->doc = doc; in xmlShell()
2820 ctxt->input = input; in xmlShell()
2821 ctxt->output = output; in xmlShell()
2822 ctxt->filename = (char *) xmlStrdup((xmlChar *) filename); in xmlShell()
2823 ctxt->node = (xmlNodePtr) ctxt->doc; in xmlShell()
2826 ctxt->pctxt = xmlXPathNewContext(ctxt->doc); in xmlShell()
2827 if (ctxt->pctxt == NULL) { in xmlShell()
2833 if (ctxt->node == (xmlNodePtr) ctxt->doc) in xmlShell()
2835 else if ((ctxt->node != NULL) && (ctxt->node->name) && in xmlShell()
2836 (ctxt->node->ns) && (ctxt->node->ns->prefix)) in xmlShell()
2838 (ctxt->node->ns->prefix), ctxt->node->name); in xmlShell()
2839 else if ((ctxt->node != NULL) && (ctxt->node->name)) in xmlShell()
2840 snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name); in xmlShell()
2843 prompt[sizeof(prompt) - 1] = 0; in xmlShell()
2848 cmdline = ctxt->input(prompt); in xmlShell()
2892 fprintf(ctxt->output, "\tbase display XML base of the node\n"); in xmlShell()
2893 fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n"); in xmlShell()
2894 fprintf(ctxt->output, "\tbye leave shell\n"); in xmlShell()
2895 fprintf(ctxt->output, "\tcat [node] display node or current node\n"); in xmlShell()
2896 fprintf(ctxt->output, "\tcd [path] change directory to path or to root\n"); in xmlShell()
2897 …fprintf(ctxt->output, "\tdir [path] dumps information about the node (namespace, attributes, con… in xmlShell()
2898 …fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current … in xmlShell()
2899 fprintf(ctxt->output, "\texit leave shell\n"); in xmlShell()
2900 fprintf(ctxt->output, "\thelp display this help\n"); in xmlShell()
2901 fprintf(ctxt->output, "\tfree display memory usage\n"); in xmlShell()
2902 fprintf(ctxt->output, "\tload [name] load a new document with name\n"); in xmlShell()
2903 fprintf(ctxt->output, "\tls [path] list contents of path or the current directory\n"); in xmlShell()
2904 …fprintf(ctxt->output, "\tset xml_fragment replace the current node content with the fragment parse… in xmlShell()
2906 …fprintf(ctxt->output, "\txpath expr evaluate the XPath expression in that context and print the … in xmlShell()
2907 …fprintf(ctxt->output, "\tsetns nsreg register a namespace to a prefix in the XPath evaluation con… in xmlShell()
2908 …fprintf(ctxt->output, "\t format for nsreg is: prefix=[nsuri] (i.e. prefix= unsets a p… in xmlShell()
2909 fprintf(ctxt->output, "\tsetrootns register all namespace found on the root element\n"); in xmlShell()
2910 fprintf(ctxt->output, "\t the default namespace if any uses 'defaultns' prefix\n"); in xmlShell()
2912 fprintf(ctxt->output, "\tpwd display current working directory\n"); in xmlShell()
2913 …fprintf(ctxt->output, "\twhereis display absolute path of [path] or current working directory… in xmlShell()
2914 fprintf(ctxt->output, "\tquit leave shell\n"); in xmlShell()
2916 fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n"); in xmlShell()
2917 fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n"); in xmlShell()
2920 fprintf(ctxt->output, "\tvalidate check the document for errors\n"); in xmlShell()
2923 fprintf(ctxt->output, "\trelaxng rng validate the document against the Relax-NG schemas\n"); in xmlShell()
2925 fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n"); in xmlShell()
2944 xmlShellWrite(ctxt, arg, ctxt->node, NULL); in xmlShell()
2947 xmlShellGrep(ctxt, arg, ctxt->node, NULL); in xmlShell()
2950 xmlMemShow(ctxt->output, 0); in xmlShell()
2955 xmlMemShow(ctxt->output, len); in xmlShell()
2960 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) in xmlShell()
2961 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
2964 xmlShellDu(ctxt, NULL, ctxt->node, NULL); in xmlShell()
2966 ctxt->pctxt->node = ctxt->node; in xmlShell()
2968 ctxt->pctxt->node = ctxt->node; in xmlShell()
2969 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
2974 switch (list->type) { in xmlShell()
2982 if (list->nodesetval == NULL) in xmlShell()
2986 indx < list->nodesetval->nodeNr; in xmlShell()
2989 list->nodesetval-> in xmlShell()
3021 "%s is user-defined\n", arg); in xmlShell()
3036 ctxt->pctxt->node = NULL; in xmlShell()
3039 xmlShellBase(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3041 xmlShellSetContent(ctxt, arg, ctxt->node, NULL); in xmlShell()
3053 root = xmlDocGetRootElement(ctxt->doc); in xmlShell()
3060 ctxt->pctxt->node = ctxt->node; in xmlShell()
3061 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3062 xmlXPathDebugDumpObject(ctxt->output, list, 0); in xmlShell()
3068 xmlShellSetBase(ctxt, arg, ctxt->node, NULL); in xmlShell()
3075 xmlShellDir(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3077 xmlShellList(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3079 ctxt->pctxt->node = ctxt->node; in xmlShell()
3081 ctxt->pctxt->node = ctxt->node; in xmlShell()
3082 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3087 switch (list->type) { in xmlShell()
3095 if (list->nodesetval == NULL) in xmlShell()
3099 indx < list->nodesetval->nodeNr; in xmlShell()
3103 list->nodesetval-> in xmlShell()
3107 list->nodesetval-> in xmlShell()
3140 "%s is user-defined\n", arg); in xmlShell()
3155 ctxt->pctxt->node = NULL; in xmlShell()
3161 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) in xmlShell()
3162 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
3164 ctxt->pctxt->node = ctxt->node; in xmlShell()
3166 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3171 switch (list->type) { in xmlShell()
3179 if (list->nodesetval == NULL) in xmlShell()
3183 indx < list->nodesetval->nodeNr; in xmlShell()
3185 if (!xmlShellPwd(ctxt, dir, list->nodesetval-> in xmlShell()
3187 fprintf(ctxt->output, "%s\n", dir); in xmlShell()
3219 "%s is user-defined\n", arg); in xmlShell()
3234 ctxt->pctxt->node = NULL; in xmlShell()
3238 ctxt->node = (xmlNodePtr) ctxt->doc; in xmlShell()
3243 ctxt->pctxt->node = ctxt->node; in xmlShell()
3245 if ((l >= 2) && (arg[l - 1] == '/')) in xmlShell()
3246 arg[l - 1] = 0; in xmlShell()
3247 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3252 switch (list->type) { in xmlShell()
3258 if (list->nodesetval != NULL) { in xmlShell()
3259 if (list->nodesetval->nodeNr == 1) { in xmlShell()
3260 ctxt->node = list->nodesetval->nodeTab[0]; in xmlShell()
3261 if ((ctxt->node != NULL) && in xmlShell()
3262 (ctxt->node->type == in xmlShell()
3266 ctxt->node = NULL; in xmlShell()
3272 list->nodesetval->nodeNr); in xmlShell()
3306 "%s is user-defined\n", arg); in xmlShell()
3321 ctxt->pctxt->node = NULL; in xmlShell()
3326 xmlShellCat(ctxt, NULL, ctxt->node, NULL); in xmlShell()
3328 ctxt->pctxt->node = ctxt->node; in xmlShell()
3330 ctxt->pctxt->node = ctxt->node; in xmlShell()
3331 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); in xmlShell()
3336 switch (list->type) { in xmlShell()
3344 if (list->nodesetval == NULL) in xmlShell()
3348 indx < list->nodesetval->nodeNr; in xmlShell()
3351 fprintf(ctxt->output, " -------\n"); in xmlShell()
3353 list->nodesetval-> in xmlShell()
3386 "%s is user-defined\n", arg); in xmlShell()
3401 ctxt->pctxt->node = NULL; in xmlShell()
3412 xmlXPathFreeContext(ctxt->pctxt); in xmlShell()
3414 if (ctxt->loaded) { in xmlShell()
3415 xmlFreeDoc(ctxt->doc); in xmlShell()
3417 if (ctxt->filename != NULL) in xmlShell()
3418 xmlFree(ctxt->filename); in xmlShell()