Re: [xml] using xmlTextWriterStartAttributeNS causing infinite loop

On Mon, Feb 21, 2005 at 08:15:00AM -0500, Rob Richards wrote:
When using xmlTextWriterStartAttributeNS, I am running into a stack 
overflow as I end up in an infinite loop.
Reduced code down to smallest example and using 
xmlTextWriterEndAttribute makes no difference.

writer = xmlNewTextWriterFilename ("testwriter.xml", 0);
xmlTextWriterStartElement (writer, "element");
xmlTextWriterStartAttributeNS (writer, "prefix", "nameatt", "nsuri");
xmlTextWriterEndElement (writer);
xmlFreeTextWriter (writer);

When xmlTextWriterEndAttribute is hit (in this case from 
xmlTextWriterEndElement), I get stuck in:
while (!xmlListEmpty(writer->nsstack)) {

The nsstack doesnt get popped until after xmlTextWriterWriteAttribute 
call, but in the meantime, xmlTextWriterWriteAttribute calls 
xmlTextWriterEndAttribute. The only way I could figure out how to get 
this to work was to pop it before the xmlTextWriterWriteAttribute call, 
which also meant having to dupe the prefix and uri. On a windows box 
right now so havent been able to run regression tests.

  Applied , doesn't seems to break, but next time ptovide patches as
attachments :-)



Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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