AW: [xml] Combining two xml files.



Title: RE: [xml] Combining two xml files.
Hi Manish,
 
first of all, please do not send HTML formatted mail to this list. A lot of the subscribers use mail agents that do not support HTML. The chance to get an answer is better if you use plain text.
[...]
 

                        xmlString = xmlNodeListGetString(a_docPtr, cur_node->xmlChildrenNode, 1);
                        if(xmlString!= NULL)
                        {
                                rc = xmlTextWriterWriteFormatElement(aWriter, BAD_CAST cur_node->name,"%s",BAD_CAST xmlString); 

Maybe you should use something like the following here...:

                                        rc = xmltextWriterStartElement(sWriter, cur_node->name);

                                        rc = xmlTextWriterWriteText(sWriter, xmlString);

...and leave the element open to be closed at the end of the function. I did not test this, but it seems that you get xmlTextWriterEndElement() called when you enter this branch of the if statement too, which can be the cause of your trouble.

                                xmlFree(xmlString);
                        }
                        else
                        {
                                rc = xmlTextWriterStartElement(aWriter, BAD_CAST cur_node->name);
                        }
                }  

[...] .

         rc = xmlTextWriterEndElement(aWriter);
}

 [...]

Servus -- Alfred

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]