Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::XML::Node* sp_repr_lookup_child ( Inkscape::XML::Node repr,
gchar const *  key,
gchar const *  value 
)

Find an element node using an unique attribute.

This function returns the first child of the specified node that has the attribute key equal to value. Note that this function does not recurse.

Parameters:
repr The node to start from
key The name of the attribute to use for comparisons
value The value of the attribute to look for

Definition at line 420 of file repr-util.cpp.

{
    g_return_val_if_fail(repr != NULL, NULL);
    for ( Inkscape::XML::Node *child = repr->firstChild() ; child ; child = child->next() ) {
        gchar const *child_value = child->attribute(key);
        if ( (child_value == value) ||
             (value && child_value && !strcmp(child_value, value)) )
        {
            return child;
        }
    }
    return NULL;
}


Generated by  Doxygen 1.6.0   Back to index