Hi, I am trying to implement a music database search similar to the search box in iTunes and other players. So far I have parsed the iTunes library xml database into the same form as used in the juce table demo, this displays fine. Now I am trying to impliment the search by making a copy of the whole library and removing entries that don’t contain the search string.
I am using the forEachXmlChildElement and then the removeChildElement() method. The search algorithm must be working because the debug statement in the else braces returns the correct XmlElements (the ones that should be kept). However only the first child from the parent that doesn’t match the string is ever removed, not everything that doesn’t get printed.
forEachXmlChildElement(*parent, e)
{
if (!e->getAttributeValue(columns::Artist).containsIgnoreCase(newFiltertext))
{
parent->removeChildElement(e, true);
}
else {
DBG(e->createDocument(""));
}
}
Not sure what’s going on here, does the XmlElement structure of the library get messed up when elements are removed or something as it can’t seem to remove more that one element.
Any help would be much appriciated.