[xml] Re: Access Violation

Daniel Veillard wrote:
On Mon, Jul 28, 2003 at 03:15:09PM +0100, Vincent Finn wrote:

I am using it as follows
void fn(xmlNodePtr pOperationElement)
        xmlNodePtr pEvent = pOperationElement->children;
        while (pEvent != NULL)
                xmlNodePtr pValueText = pValue->children;
                const char* bstrValueText = reinterpret_cast<char
                // etc...
                pEvent = pEvent->next;

I assume since it looks like heap corruption that I am misusing the library
in some way
Is there anything here that looks wrong to anyone?

  accessing ->content without checking the type of the node first
is 100% wrong. You're making assumption which is very likely to be false.

In my case it won't ever be false.
Unless I have misunderstood content is for getting the text from a text node, in which case I would have thought what I am doing is fine

I know with 100% certainty that the node I am accessing is of the form
so I use content to access the text values

As far as I could tell it seemed the same as using xmlNodeListGetString() but without the need to free the xmlChar which seemed to be a better solution for me since I am purely reading and want to avoid any data copying I can

Is using content inherently unsafe?


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