57 for (i = (
size_t)0; i < plen; ++i) {
90 const char* nodeName = NULL;
91 const char* nodeValue = NULL;
94 if (nodeptr != NULL) {
103 case eCDATA_SECTION_NODE:
109 case ePROCESSING_INSTRUCTION_NODE:
121 case eATTRIBUTE_NODE:
126 if (nodeptr->nextSibling != NULL) {
135 if (nodeptr->firstAttr != NULL) {
153 if (sibling != NULL &&
163 IxmlPrintf(__FILE__, __LINE__,
"ixmlPrintDomTreeRecursive",
164 "Warning, unknown node type %d\n",
182 const char* nodeName = NULL;
183 const char* nodeValue = NULL;
186 if (nodeptr == NULL || buf == NULL) {
194 case eCDATA_SECTION_NODE:
195 case ePROCESSING_INSTRUCTION_NODE:
200 case eATTRIBUTE_NODE:
210 if (nodeptr->firstAttr != NULL) {
231 IxmlPrintf(__FILE__, __LINE__,
"ixmlPrintDomTree",
232 "Warning, unknown node type %d\n",
249 const char* nodeName = NULL;
250 const char* nodeValue = NULL;
253 if (nodeptr == NULL || buf == NULL) {
262 case eCDATA_SECTION_NODE:
263 case ePROCESSING_INSTRUCTION_NODE:
268 case eATTRIBUTE_NODE:
278 if (nodeptr->firstAttr != NULL) {
299 IxmlPrintf(__FILE__, __LINE__,
"ixmlPrintDomTreeRecursive",
300 "Warning, unknown node type %d\n",
307 if (xmlFile == NULL || doc == NULL) {
308 return IXML_INVALID_PARAMETER;
327 if (rootNode == NULL) {
357 if (rootNode == NULL) {
384#ifdef IXML_HAVE_SCRIPTSUPPORT
385void ixmlSetBeforeFree(IXML_BeforeFreeNode_t hndlr) {
386 Parser_setBeforeFree(hndlr);
391 if (buffer == NULL || retDoc == NULL) {
392 return IXML_INVALID_PARAMETER;
395 if (buffer[0] ==
'\0') {
396 return IXML_INVALID_PARAMETER;
Data structure common to all types of nodes.
Data structure representing the DOM Document.
DOMString ixmlPrintNode(IXML_Node *node)
Renders a Node and all sub-elements into an XML text representation.
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.
DOMString ixmlNodetoString(IXML_Node *node)
Renders a Node and all sub-elements into an XML text representation. The caller is required to free t...
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
Parses an XML text buffer converting it into an IXML DOM representation.
#define DOMString
The type of DOM strings.
PUPNP_Api IXML_Node * ixmlNode_getNextSibling(IXML_Node *nodeptr)
Retrieves the sibling Node immediately following this Node.
void ixmlRelaxParser(char errorChar)
Makes the XML parser more tolerant to malformed text.
PUPNP_Api const DOMString ixmlNode_getNodeValue(IXML_Node *nodeptr)
Returns the value of the Node as a string.
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.
DOMString ixmlPrintDocument(IXML_Document *doc)
Renders a Node and all sub-elements into an XML document representation.
DOMString ixmlDocumenttoString(IXML_Document *doc)
Renders a Node and all sub-elements into an XML document representation.
int ixmlLoadDocumentEx(const char *xmlFile, IXML_Document **doc)
Parses an XML text file converting it into an IXML DOM representation.
IXML_Document * ixmlLoadDocument(const char *xmlFile)
Parses an XML text file converting it into an IXML DOM representation.
void ixmlFreeDOMString(DOMString buf)
Frees a DOMString.
DOMString ixmlCloneDOMString(const DOMString src)
Clones an existing DOMString.
PUPNP_Api IXML_Node * ixmlNode_getFirstChild(IXML_Node *nodeptr)
Retrieves the first child Node of a Node.
IXML_Document * ixmlParseBuffer(const char *buffer)
Parses an XML text buffer converting it into an IXML DOM representation.
static void ixmlPrintDomTree(IXML_Node *nodeptr, ixml_membuf *buf)
Print a DOM tree.
static void ixmlPrintDomTreeRecursive(IXML_Node *nodeptr, ixml_membuf *buf)
Recursive function to print all the node in a tree. Internal to parser only.
static void ixmlDomTreetoString(IXML_Node *nodeptr, ixml_membuf *buf)
Converts a DOM tree into a text string.
static void copy_with_escape(ixml_membuf *buf, const char *p)
Appends a string to a buffer, substituting some characters by escape sequences.
Auxiliar routines to aid debugging.
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 ...
void ixml_membuf_init(ixml_membuf *m)
ixml_membuf initialization routine.
int ixml_membuf_append(ixml_membuf *m, const void *buf)
Appends one byte to the designated ixml_membuffer.
int ixml_membuf_append_str(ixml_membuf *m, const char *c_str)
Appends the contents of a NULL terminated string to the designated ixml_membuf.
int Parser_LoadDocument(IXML_Document **retDoc, const char *xmlFile, int file)
Parses a xml file and return the DOM tree.
void Parser_setErrorChar(char c)
Sets the error character.