UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
ixmldebug.cpp
Go to the documentation of this file.
1// Copyright (C) 2022+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
2// Redistribution only with this Copyright remark. Last modified: 2026-03-31
3// Taken from authors who haven't made a note.
4// Last compare with ./Pupnp source file, based on 2026-03-16, ver 1.14.30
5
10// #include "autoconfig.h"
11
12#include <ixml/ixmldebug.hpp>
13
14#include <cstdarg>
15#include <cstdio>
16
17#ifdef DEBUG
18void IxmlPrintf(const char* DbgFileName, int DbgLineNo,
19 const char* FunctionName, const char* FmtStr, ...) {
20 va_list ArgList;
21
22 FILE* fp = stdout;
23 fprintf(fp, "(%s::%s), line %d", DbgFileName, FunctionName, DbgLineNo);
24 if (FmtStr) {
25 fprintf(fp, ": ");
26 va_start(ArgList, FmtStr);
27 vfprintf(fp, FmtStr, ArgList);
28 fflush(fp);
29 va_end(ArgList);
30 } else {
31 fprintf(fp, "\n");
32 }
33}
34
35void printNodes(IXML_Node* tmpRoot, int depth) {
36 unsigned long i;
37 IXML_NodeList* NodeList1;
38 IXML_Node* ChildNode1;
39 unsigned short NodeType;
40 const DOMString NodeValue;
41 const DOMString NodeName;
42 NodeList1 = ixmlNode_getChildNodes(tmpRoot);
43 for (i = 0; i < 100; ++i) {
44 ChildNode1 = ixmlNodeList_item(NodeList1, i);
45 if (!ChildNode1) {
46 break;
47 }
48
49 printNodes(ChildNode1, depth + 1);
50 NodeType = ixmlNode_getNodeType(ChildNode1);
51 NodeValue = ixmlNode_getNodeValue(ChildNode1);
52 NodeName = ixmlNode_getNodeName(ChildNode1);
53 IxmlPrintf(__FILE__, __LINE__, "printNodes",
54 "DEPTH-%2d-IXML_Node Type %d, "
55 "IXML_Node Name: %s, IXML_Node Value: %s\n",
56 depth, NodeType, NodeName, NodeValue);
57 }
58}
59
60#endif
Data structure common to all types of nodes.
Definition ixml.hpp:132
Data structure representing a list of nodes.
Definition ixml.hpp:193
PUPNP_Api unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr)
Retrieves the type of a Node. Note that not all possible return values are actually implemented.
Definition node.cpp:322
#define DOMString
The type of DOM strings.
Definition ixml.hpp:47
PUPNP_Api const DOMString ixmlNode_getNodeValue(IXML_Node *nodeptr)
Returns the value of the Node as a string.
Definition node.cpp:294
PUPNP_Api const DOMString ixmlNode_getNodeName(IXML_Node *nodeptr)
Returns the name of the Node, depending on what type of Node it is, in a read-only string.
Definition node.cpp:182
PUPNP_Api IXML_NodeList * ixmlNode_getChildNodes(IXML_Node *nodeptr)
Retrieves the list of children of a Node in a NodeList structure.
Definition node.cpp:1075
PUPNP_Api IXML_Node * ixmlNodeList_item(IXML_NodeList *nList, unsigned long index)
Retrieves a Node from a NodeList specified by a numerical index.
Definition nodeList.cpp:49
void IxmlPrintf(const char *DbgFileName, int DbgLineNo, const char *FunctionName, const char *FmtStr,...)
Prints the debug statement either on the standard output or log file along with the information from ...
Definition ixmldebug.cpp:18
void printNodes(IXML_Node *tmpRoot, int depth)
Print the node names and values of a XML tree.
Definition ixmldebug.cpp:35
Auxiliar routines to aid debugging.