XmlElement::getChildByAttribute


#1

Hello,

I think adding a method to XmlElement to allow matching a child based on the value of an attribute, if it is present, would be useful. Its signature would look like this:

XmlElement* getChildByAttribute (const String& attributeNameToLookFor, const String& attributeValueToMatchOn) const noexcept; 

The code is trivial to write -- in fact I've already written and tested it, taking care to respect the coding style/standards and provide comments (there's a tiny alteration to the comments of getChildByName to reference the new method in the docs, in addition to the docs for the afore-mentioned method). I've attached the changes to both the header and implementation files; feel free to use it, no strings attached.

Kind regards


#2

Yeah, good idea! Hmm, it's a bit odd that I must have never needed that before. Anyway, thanks, I'll throw that in there!