예제 #1
0
    void XMLNodeList::setElementAtPosition(double index, const XMLNodeList & list)
    {
        if (list.getSize() && list.getRealNode() != parent)
        {
            int pos = (int)index;

            if (index < 1)
            {
                pos = 1;
            }
            else if (index > size)
            {
                pos = size++;
            }
            else if ((int)index != index)
            {
                pos++;
            }

            setElementAtPosition(index, XMLElement(doc, list.getRealNode()));
            for (xmlNode * cur = list.getRealNode()->next; cur; cur = cur->next)
            {
                setElementAtPosition((double)(pos++) + 0.5, XMLElement(doc, cur));
            }
        }
    }
예제 #2
0
void XMLElement::setChildren(const XMLNodeList & list) const
{
    xmlNode *n = list.getRealNode();
    if (n && n->parent != node)
    {
        xmlNode *cpy = xmlCopyNodeList(n);
        xmlUnlinkNode(node->children);
        xmlFreeNodeList(node->children);
        node->children = 0;
        xmlAddChildList(node, cpy);
    }
}