Arrays / strings / comparators / XML

I can easily open an XML file and put it into an XmlElement. My XML files look something like this:

<cunittest> <suite name="WinDriverTests"> <test name="BlockWordRead"> <devtype>PCI, PCIe</devtype> </test> <test name="DeviceToHostDMA"> <devtype>PCI, PCIe</devtype> </test> <test name="DiscreteIO"> <devtype>PCI, PCIe</devtype> </test> <test name="HalfWordInvert"> <devtype>PCI, PCIe</devtype> </test> </suite> <suite name="UniversalTests"> <test name="TestA"> <devtype>PCI</devtype> </test> <test name="TestB"> <devtype>PCI</devtype> </test> <test name="TestC"> <devtype>PCI</devtype> </test> </suite> </cunittest>

And what I’d like to do is parse that into a few arrays. I need need two arrays of “test” elements: one for available tests and one for selected tests. Seems like I should just leave them as XmlElements since I can easily parse the name of the test out of that.

I was hoping I could do something like this:

[code]Array<XmlElement*> aSuiteList;
Array<XmlElement*> aTestList;
Array<XmlElement*> aTestSelected;

ForEachXmlChildElementWithTagName( *mainElement, child, T(“suite”) )
{
aSuiteList.addSorted( child->attributes->name, child );

}

ForEachXmlChildElementWithTagName( *selectedSuite, child, T(“test”) )
{
aTestList.addSorted( child->attributes->name, child );

}
[/code]

But Strings don’t have an “ElemenetComparator”, just “compare”, so my code doesn’t work at all. I could make my own comparator, but obviously I’m missing something, because I’m sure I’m not the first one to want to add items alphabetically to an array.

I did read haydxn’s tutorial and looked at the help for quite awhile, but I’m just a big noob.