Hi There,

        I have just come accross a rather strange error in the Xerces library (cc
build for solaris 2.7).

The following code causes the library to core dump:

/** Function to get the value of a node
        This functon takes care of allocating memory and freeing it and
        returning the name of the node copied into a static character array */
static void getNodeValue (char *data, const DOMNode *node)
{
        //get the name of the DOM node
        char *name = XMLString::transcode(node->getNodeValue());
        int index = 0;
        //only extract text with no ws characterc
        while(*name)//isspace(*name))
        {
                if (!isspace(*name))
                {
                        data[index++] = *name;
                }
                //move to the next character
                name ++;
        }
        //set the end of the string
        data[index] = 0;
        //release the memory
        XMLString::release(&name);
}

the core dump occurrs in the XMLString::release method, but it works fine
when running the Xerces library on windows.

However it does not core dump immediately, only after processing about half
of the document and the below code seems to fix it.

static void getNodeValue (char *data, const DOMNode *node)
{
        //get the name of the DOM node
        char *tmp = XMLString::transcode(node->getNodeValue());
        char *name = tmp;
        int index = 0;
        //only extract text with no ws characterc
        while(*name)//isspace(*name))
        {
                if (!isspace(*name))
                {
                        data[index++] = *name;
                }
                //move to the next character
                name ++;
        }
        //set the end of the string
        data[index] = 0;
        //release the memory
        XMLString::release(&tmp);
}

Could anyone please tell me if there is a bug already raised on this or at
least offer a reason for the core dump.

Thanks

Pete


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to