string getTagAttributeValue(Tag tag, string wantedAttributeName) { int location = 0; for(int i = 0; i < tag.getAttributeName().size(); i++) { if(tag.getAttributeName()[i] == wantedAttributeName) { location = i; } } return tag.getAttributeValue()[location]; }
string processQuery(string query, const vector<Tag> &tags, bool isNested) { string wantedTagName = getWantedTagName(query); string wantedAttributeName = getWantedAttributeName(query); Tag tag = getWantedTag(tags, wantedTagName); if(tagHasAttribute(tag.getAttributeName(), wantedAttributeName)) { string attributeValue = getTagAttributeValue(tag, wantedAttributeName); vector<string> nested = tag.getNested(); if((nested.size() == 0 && !isNested) || (nested.size() > 0 && isNested)) { return attributeValue; } else { return "Not Found!"; } } else { return "Not Found!"; } }