[xml] multiple Attribute values?



Hi,

I just came accross the following piece of code in a project, which
attemps to retreive multiple values of a single attribute. Is this
possible?
The code uses libxml 1.8.6

Since val has a next member, you could think this is possible.

void FileLoader::copyAttributes (Node *node, ::xmlNodePtr libxmlNode)
{
    ::xmlAttrPtr libProp = libxmlNode->properties;
    while (libProp != NULL)
    {
        ::xmlNodePtr libVal = libProp->val;

        // Attribute mit erstem Value
        Attribute* att = node->appendAttribute (Attribute::CData,
                                                libProp->name,
                                                libVal->content);
        libVal = libVal->next;

        // restliche Values
        //this is an error! there cannot be more than one attribute value
        while (libVal != NULL)
        {
            AttributeValue* val = att->appendValue (libVal->content);
            delete val;
            libVal = libVal->next;
        }

        delete att;
        libProp = libProp->next;
    }
}


-- 
Gregor Zeitlinger
gregor zeitlinger de






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