Lines Matching refs:node

46     xmlNodePtr node;		/* current node */
54 static void xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node);
66 ctxt->node = NULL;
83 * @node: the node
84 * @ns: the namespace node
86 * Check that a given namespace is in scope on a node.
90 * an ancestor node.
93 xmlNsCheckScope(xmlNodePtr node, xmlNsPtr ns)
97 if ((node == NULL) || (ns == NULL))
100 if ((node->type != XML_ELEMENT_NODE) &&
101 (node->type != XML_ATTRIBUTE_NODE) &&
102 (node->type != XML_DOCUMENT_NODE) &&
103 (node->type != XML_TEXT_NODE) &&
104 (node->type != XML_HTML_DOCUMENT_NODE) &&
105 (node->type != XML_XINCLUDE_START))
108 while ((node != NULL) &&
109 ((node->type == XML_ELEMENT_NODE) ||
110 (node->type == XML_ATTRIBUTE_NODE) ||
111 (node->type == XML_TEXT_NODE) ||
112 (node->type == XML_XINCLUDE_START))) {
113 if ((node->type == XML_ELEMENT_NODE) ||
114 (node->type == XML_XINCLUDE_START)) {
115 cur = node->nsDef;
124 node = node->parent;
126 /* the xml namespace may be declared on the document node */
127 if ((node != NULL) &&
128 ((node->type == XML_DOCUMENT_NODE) ||
129 (node->type == XML_HTML_DOCUMENT_NODE))) {
130 xmlNsPtr oldNs = ((xmlDocPtr) node)->oldNs;
162 NULL, ctxt->node, XML_FROM_CHECK,
172 NULL, ctxt->node, XML_FROM_CHECK,
182 NULL, ctxt->node, XML_FROM_CHECK,
191 * @node: the node
192 * @ns: the namespace node
197 xmlCtxtNsCheckScope(xmlDebugCtxtPtr ctxt, xmlNodePtr node, xmlNsPtr ns)
201 ret = xmlNsCheckScope(node, ns);
273 xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
277 doc = node->doc;
279 if (node->parent == NULL)
282 if (node->doc == NULL) {
304 if ((node->parent != NULL) && (node->doc != node->parent->doc) &&
305 (!xmlStrEqual(node->name, BAD_CAST "pseudoroot")))
308 if (node->prev == NULL) {
309 if (node->type == XML_ATTRIBUTE_NODE) {
310 if ((node->parent != NULL) &&
311 (node != (xmlNodePtr) node->parent->properties))
315 } else if ((node->parent != NULL) && (node->parent->children != node))
319 if (node->prev->next != node)
323 if (node->next == NULL) {
324 if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) &&
325 (node->parent->last != node) &&
326 (node->parent->type == XML_ELEMENT_NODE))
330 if (node->next->prev != node)
333 if (node->next->parent != node->parent)
337 if (node->type == XML_ELEMENT_NODE) {
340 ns = node->nsDef;
342 xmlCtxtNsCheckScope(ctxt, node, ns);
345 if (node->ns != NULL)
346 xmlCtxtNsCheckScope(ctxt, node, node->ns);
347 } else if (node->type == XML_ATTRIBUTE_NODE) {
348 if (node->ns != NULL)
349 xmlCtxtNsCheckScope(ctxt, node, node->ns);
352 if ((node->type != XML_ELEMENT_NODE) &&
353 (node->type != XML_ATTRIBUTE_NODE) &&
354 (node->type != XML_ELEMENT_DECL) &&
355 (node->type != XML_ATTRIBUTE_DECL) &&
356 (node->type != XML_DTD_NODE) &&
357 (node->type != XML_HTML_DOCUMENT_NODE) &&
358 (node->type != XML_DOCUMENT_NODE)) {
359 if (node->content != NULL)
360 xmlCtxtCheckString(ctxt, (const xmlChar *) node->content);
362 switch (node->type) {
365 xmlCtxtCheckName(ctxt, node->name);
368 if ((node->name == xmlStringText) ||
369 (node->name == xmlStringTextNoenc))
373 (node->name == xmlDictLookup(ctxt->dict, BAD_CAST "nbktext",
378 "Text node has wrong name '%s'",
379 (const char *) node->name);
382 if (node->name == xmlStringComment)
385 "Comment node has wrong name '%s'",
386 (const char *) node->name);
389 xmlCtxtCheckName(ctxt, node->name);
392 if (node->name == NULL)
396 (const char *) node->name);
451 fprintf(ctxt->output, "DTD node is NULL\n");
721 fprintf(ctxt->output, "namespace node is NULL\n");
871 * @node: the node
874 * Dumps debug information for the element node, it is not recursive
877 xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
879 if (node == NULL) {
882 fprintf(ctxt->output, "node is NULL\n");
886 ctxt->node = node;
888 switch (node->type) {
893 if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
894 xmlCtxtDumpString(ctxt, node->ns->prefix);
897 xmlCtxtDumpString(ctxt, node->name);
905 xmlCtxtGenericNodeCheck(ctxt, node);
910 if (node->name == (const xmlChar *) xmlStringTextNoenc)
915 if (node->content == (xmlChar *) &(node->properties))
917 else if (xmlDictOwns(ctxt->dict, node->content) == 1)
935 (char *) node->name);
947 fprintf(ctxt->output, "PI %s\n", (char *) node->name);
962 xmlCtxtGenericNodeCheck(ctxt, node);
983 xmlCtxtDumpDtdNode(ctxt, (xmlDtdPtr) node);
986 xmlCtxtDumpElemDecl(ctxt, (xmlElementPtr) node);
989 xmlCtxtDumpAttrDecl(ctxt, (xmlAttributePtr) node);
992 xmlCtxtDumpEntityDecl(ctxt, (xmlEntityPtr) node);
995 xmlCtxtDumpNamespace(ctxt, (xmlNsPtr) node);
1013 "Unknown node type %d\n", node->type);
1016 if (node->doc == NULL) {
1023 if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
1024 xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
1025 if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
1026 xmlCtxtDumpAttrList(ctxt, node->properties);
1027 if (node->type != XML_ENTITY_REF_NODE) {
1028 if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
1032 xmlCtxtDumpString(ctxt, node->content);
1039 ent = xmlGetDocEntity(node->doc, node->name);
1048 xmlCtxtGenericNodeCheck(ctxt, node);
1054 * @node: the node
1057 * Dumps debug information for the element node, it is recursive
1060 xmlCtxtDumpNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1062 if (node == NULL) {
1065 fprintf(ctxt->output, "node is NULL\n");
1069 xmlCtxtDumpOneNode(ctxt, node);
1070 if ((node->type != XML_NAMESPACE_DECL) &&
1071 (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
1073 xmlCtxtDumpNodeList(ctxt, node->children);
1081 * @node: the node list
1084 * Dumps debug information for the list of element node, it is recursive
1087 xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1089 while (node != NULL) {
1090 xmlCtxtDumpNode(ctxt, node);
1091 node = node->next;
1103 ctxt->node = (xmlNodePtr) doc;
1108 "Misplaced ELEMENT node\n");
1112 "Misplaced ATTRIBUTE node\n");
1116 "Misplaced TEXT node\n");
1120 "Misplaced CDATA node\n");
1124 "Misplaced ENTITYREF node\n");
1128 "Misplaced ENTITY node\n");
1132 "Misplaced PI node\n");
1136 "Misplaced COMMENT node\n");
1148 "Misplaced DOCTYPE node\n");
1152 "Misplaced FRAGMENT node\n");
1156 "Misplaced NOTATION node\n");
1160 "Unknown node type %d\n", doc->type);
1431 * @node: the node
1434 * Dumps debug information for the element node, it is not recursive
1437 xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
1445 xmlCtxtDumpOneNode(&ctxt, node);
1452 * @node: the node
1455 * Dumps debug information for the element node, it is recursive
1458 xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
1467 xmlCtxtDumpNode(&ctxt, node);
1474 * @node: the node list
1477 * Dumps debug information for the list of element node, it is recursive
1480 xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
1489 xmlCtxtDumpNodeList(&ctxt, node);
1595 * @node: the node to count
1597 * Count the children of @node.
1599 * Returns the number of children of @node.
1602 xmlLsCountNode(xmlNodePtr node) {
1606 if (node == NULL)
1609 switch (node->type) {
1611 list = node->children;
1618 list = ((xmlDocPtr) node)->children;
1621 list = ((xmlAttrPtr) node)->children;
1627 if (node->content != NULL) {
1628 ret = xmlStrlen(node->content);
1654 * @node: the node to dump
1656 * Dump to @output the type and name of @node.
1659 xmlLsOneNode(FILE *output, xmlNodePtr node) {
1661 if (node == NULL) {
1665 switch (node->type) {
1711 if (node->type != XML_NAMESPACE_DECL) {
1712 if (node->properties != NULL)
1716 if (node->nsDef != NULL)
1722 fprintf(output, " %8d ", xmlLsCountNode(node));
1724 switch (node->type) {
1726 if (node->name != NULL) {
1727 if ((node->ns != NULL) && (node->ns->prefix != NULL))
1728 fprintf(output, "%s:", node->ns->prefix);
1729 fprintf(output, "%s", (const char *) node->name);
1733 if (node->name != NULL)
1734 fprintf(output, "%s", (const char *) node->name);
1737 if (node->content != NULL) {
1738 xmlDebugDumpString(output, node->content);
1744 if (node->name != NULL)
1745 fprintf(output, "%s", (const char *) node->name);
1748 if (node->name != NULL)
1749 fprintf(output, "%s", (const char *) node->name);
1752 if (node->name != NULL)
1753 fprintf(output, "%s", (const char *) node->name);
1768 xmlNsPtr ns = (xmlNsPtr) node;
1778 if (node->name != NULL)
1779 fprintf(output, "%s", (const char *) node->name);
1835 "%s: no such node\n", arg);
1883 * @node : a non-null node to print to the output FILE
1885 * Print node to the output FILE
1888 xmlShellPrintNodeCtxt(xmlShellCtxtPtr ctxt,xmlNodePtr node)
1892 if (!node)
1899 if (node->type == XML_DOCUMENT_NODE)
1900 xmlDocDump(fp, (xmlDocPtr) node);
1901 else if (node->type == XML_ATTRIBUTE_NODE)
1902 xmlDebugDumpAttrList(fp, (xmlAttrPtr) node, 0);
1904 xmlElemDump(fp, node->doc, node);
1911 * @node : a non-null node to print to the output FILE
1913 * Print node to the output FILE
1916 xmlShellPrintNode(xmlNodePtr node)
1918 xmlShellPrintNodeCtxt(NULL, node);
1949 "Empty node set\n");
1993 * @node: a node
1997 * Does an Unix like listing of the given node (like a directory)
2003 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2009 if (node == NULL) {
2013 if ((node->type == XML_DOCUMENT_NODE) ||
2014 (node->type == XML_HTML_DOCUMENT_NODE)) {
2015 cur = ((xmlDocPtr) node)->children;
2016 } else if (node->type == XML_NAMESPACE_DECL) {
2017 xmlLsOneNode(ctxt->output, node);
2019 } else if (node->children != NULL) {
2020 cur = node->children;
2022 xmlLsOneNode(ctxt->output, node);
2036 * @node: a node
2040 * dumps the current XML base of the node
2046 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2052 if (node == NULL) {
2057 base = xmlNodeGetBase(node->doc, node);
2073 * @node: a node
2077 * change the current XML base of the node
2083 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2086 xmlNodeSetBase(node, (xmlChar*) arg);
2096 * @node: unused
2107 xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2153 * @node: the root element
2186 * @node: a node
2190 * dumps informations about the node (namespace, attributes, content).
2196 char *arg, xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2200 if (node == NULL)
2211 while (node != NULL) {
2212 if (node->type == XML_COMMENT_NODE) {
2213 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2215 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node));
2216 xmlShellList(ctxt, NULL, node, NULL);
2218 } else if (node->type == XML_TEXT_NODE) {
2219 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2221 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent));
2222 xmlShellList(ctxt, NULL, node->parent, NULL);
2230 if ((node->type == XML_DOCUMENT_NODE) ||
2231 (node->type == XML_HTML_DOCUMENT_NODE)) {
2232 node = ((xmlDocPtr) node)->children;
2233 } else if ((node->children != NULL)
2234 && (node->type != XML_ENTITY_REF_NODE)) {
2236 node = node->children;
2237 } else if (node->next != NULL) {
2239 node = node->next;
2242 while (node != NULL) {
2243 if (node->parent != NULL) {
2244 node = node->parent;
2246 if (node->next != NULL) {
2247 node = node->next;
2250 if (node->parent == NULL) {
2251 node = NULL;
2264 * @node: a node
2268 * dumps informations about the node (namespace, attributes, content).
2274 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2279 if (node == NULL) {
2283 if ((node->type == XML_DOCUMENT_NODE) ||
2284 (node->type == XML_HTML_DOCUMENT_NODE)) {
2285 xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node);
2286 } else if (node->type == XML_ATTRIBUTE_NODE) {
2287 xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0);
2289 xmlDebugDumpOneNode(ctxt->output, node, 0);
2298 * @node: a node
2302 * dumps informations about the node (namespace, attributes, content).
2308 char *value, xmlNodePtr node,
2316 if (node == NULL) {
2325 ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results);
2327 if (node->children != NULL) {
2328 xmlFreeNodeList(node->children);
2329 node->children = NULL;
2330 node->last = NULL;
2332 xmlAddChildList(node, results);
2344 * @node: a node
2354 xmlNodePtr node ATTRIBUTE_UNUSED,
2400 * @node: a node
2404 * dumps the serialization node content (XML or HTML).
2410 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2414 if (node == NULL) {
2420 if (node->type == XML_HTML_DOCUMENT_NODE)
2421 htmlDocDump(ctxt->output, (htmlDocPtr) node);
2423 htmlNodeDumpFile(ctxt->output, ctxt->doc, node);
2425 if (node->type == XML_DOCUMENT_NODE)
2426 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2428 xmlElemDump(ctxt->output, ctxt->doc, node);
2431 if (node->type == XML_DOCUMENT_NODE)
2432 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2434 xmlElemDump(ctxt->output, ctxt->doc, node);
2445 * @node: unused
2455 xmlNodePtr node ATTRIBUTE_UNUSED,
2485 ctxt->node = (xmlNodePtr) doc;
2500 * @node: a node in the tree
2504 * Write the current node to the filename, it saves the serialization
2505 * of the subtree under the @node specified
2510 xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
2513 if (node == NULL)
2525 switch (node->type) {
2557 xmlElemDump(f, ctxt->doc, node);
2568 * @node: unused
2578 xmlNodePtr node ATTRIBUTE_UNUSED,
2629 * @node: unused
2640 xmlNodePtr node ATTRIBUTE_UNUSED,
2671 * @tree: a node defining a subtree
2675 * show the structure of the subtree under node @tree
2676 * If @tree is null, the command works on the current node.
2685 xmlNodePtr node;
2693 node = tree;
2694 while (node != NULL) {
2695 if ((node->type == XML_DOCUMENT_NODE) ||
2696 (node->type == XML_HTML_DOCUMENT_NODE)) {
2698 } else if (node->type == XML_ELEMENT_NODE) {
2701 if ((node->ns) && (node->ns->prefix))
2702 fprintf(ctxt->output, "%s:", node->ns->prefix);
2703 fprintf(ctxt->output, "%s\n", node->name);
2711 if ((node->type == XML_DOCUMENT_NODE) ||
2712 (node->type == XML_HTML_DOCUMENT_NODE)) {
2713 node = ((xmlDocPtr) node)->children;
2714 } else if ((node->children != NULL)
2715 && (node->type != XML_ENTITY_REF_NODE)) {
2717 node = node->children;
2719 } else if ((node != tree) && (node->next != NULL)) {
2721 node = node->next;
2722 } else if (node != tree) {
2724 while (node != tree) {
2725 if (node->parent != NULL) {
2726 node = node->parent;
2729 if ((node != tree) && (node->next != NULL)) {
2730 node = node->next;
2733 if (node->parent == NULL) {
2734 node = NULL;
2737 if (node == tree) {
2738 node = NULL;
2743 if (node == tree)
2744 node = NULL;
2746 node = NULL;
2755 * @node: a node
2759 * Show the full path from the root to the node, if needed building
2767 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2771 if ((node == NULL) || (buffer == NULL))
2774 path = xmlGetNodePath(node);
2832 ctxt->node = (xmlNodePtr) ctxt->doc;
2842 if (ctxt->node == (xmlNodePtr) ctxt->doc)
2844 else if ((ctxt->node != NULL) && (ctxt->node->name) &&
2845 (ctxt->node->ns) && (ctxt->node->ns->prefix))
2847 (ctxt->node->ns->prefix), ctxt->node->name);
2848 else if ((ctxt->node != NULL) && (ctxt->node->name))
2849 snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
2901 fprintf(ctxt->output, "\tbase display XML base of the node\n");
2902 fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n");
2904 fprintf(ctxt->output, "\tcat [node] display node or current node\n");
2906 fprintf(ctxt->output, "\tdir [path] dumps informations about the node (namespace, attributes, content)\n");
2907 fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current node\n");
2913 fprintf(ctxt->output, "\tset xml_fragment replace the current node content with the fragment parsed in context\n");
2926 fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
2953 xmlShellWrite(ctxt, arg, ctxt->node, NULL);
2956 xmlShellGrep(ctxt, arg, ctxt->node, NULL);
2969 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
2973 xmlShellDu(ctxt, NULL, ctxt->node, NULL);
2975 ctxt->pctxt->node = ctxt->node;
2977 ctxt->pctxt->node = ctxt->node;
2986 "%s: no such node\n", arg);
3041 "%s: no such node\n", arg);
3043 ctxt->pctxt->node = NULL;
3046 xmlShellBase(ctxt, NULL, ctxt->node, NULL);
3048 xmlShellSetContent(ctxt, arg, ctxt->node, NULL);
3067 ctxt->pctxt->node = ctxt->node;
3075 xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
3082 xmlShellDir(ctxt, NULL, ctxt->node, NULL);
3084 xmlShellList(ctxt, NULL, ctxt->node, NULL);
3086 ctxt->pctxt->node = ctxt->node;
3088 ctxt->pctxt->node = ctxt->node;
3097 "%s: no such node\n", arg);
3158 "%s: no such node\n", arg);
3160 ctxt->pctxt->node = NULL;
3166 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
3169 ctxt->pctxt->node = ctxt->node;
3179 "%s: no such node\n", arg);
3235 "%s: no such node\n", arg);
3237 ctxt->pctxt->node = NULL;
3241 ctxt->node = (xmlNodePtr) ctxt->doc;
3244 ctxt->pctxt->node = ctxt->node;
3253 "%s: no such node\n", arg);
3258 ctxt->node = list->nodesetval->nodeTab[0];
3259 if ((ctxt->node != NULL) &&
3260 (ctxt->node->type ==
3264 ctxt->node = NULL;
3315 "%s: no such node\n", arg);
3317 ctxt->pctxt->node = NULL;
3322 xmlShellCat(ctxt, NULL, ctxt->node, NULL);
3324 ctxt->pctxt->node = ctxt->node;
3326 ctxt->pctxt->node = ctxt->node;
3335 "%s: no such node\n", arg);
3393 "%s: no such node\n", arg);
3395 ctxt->pctxt->node = NULL;